Hide

# Problem BSanta Klas

Picture by m.prinke

Santa Klas is in trouble! The ACM (Aerodynamic Christmas Machines) has called you in to be their subject matter expert for the current situation.

Santa Klas recently got himself a new bunch of reindeers, that would boost his speed even more while travelling across the sky. The reindeers even came with an autopilot, so Santa Klas calmly took off into the sky, adjusted his heading, activated his autopilot and fell asleep.

Santa Klas has been playing too much flight simulator computer games lately, and he is certain that when the autopilot is activated, the ship he is flying in will hold altitude and course. This is not the case. The autopilot on his new reindeers only guarantee that the heading is the same, and the vertical angle is kept the same. This means that if Santa Klas’ ship is currently heading for the ground, he will crash if he doesn’t wake up soon enough! If the ship isn’t pointing to the ground, Santa Klas will exit the atmosphere. But that’s fine, he’s done that before.

The ACM has given you Santa Klas’ angle between his course and the ground and altitude in meters. Help them determine how much time they have to wake him up, or if Santa Klas will exit the atmosphere. Santa Klas always flies with a speed of one meter per second (yeah, it takes him a while to round the earth).

## Input

The only line of input contains two integers $1 \le H \le 10\, 000 , 0 \le v \le 359$, Santa Klas’ current altitude and his current angle in degrees from the horizon, i.e. if $v = 0$ then Santa Klas is flying with constant altitude (since the earth is flat), and is therefore safe. If $v = 90$, then Santa Klas is heading straight for the stars.

## Output

Output should consist of one single integer: the number of whole seconds that the ACM have to safely wake Santa Klas up, so that he can adjust his course. You may assume that Santa Klas is infinitely fast at adjusting it after waking up, as the flight simulator professional he is. If Santa Klas is not heading for the ground, just print the word "safe" on a single line instead.

Sample Input 1 Sample Output 1
30 270

30

Sample Input 2 Sample Output 2
1 180

safe

CPU Time limit 1 second
Memory limit 1024 MB
Statistics Show