Woburn Challenge 2002 - Suicidal
As Gandalf hit the walls reeling from yet another shot from Saruman's magic staff, he noticed that they moved to a large room, with shiny violet walls. Immediately he knew what had taken place, but it was too late - with one movement of his staff, Saruman had shut the door.
What awaited Gandalf was an old wizard challenge, known as the Klingon Roulette. Gandalf would be placed in one corner, Saruman in another. They would shoot a fire ball, one at a time, which would then proceed to ricochet off the shimmering violet walls. Gandalf felt his power fading, so he knew his yellow flaming ball would only last about one billion () standard life times.
The contest was won when only one man was left standing. Gandalf focused to try to foresee the path of the ball…
Given a rectangular room of dimensions
and given that Gandalf fired his shot at an angle of
degrees to the horizontal and vertical from corner #, print out which
corner would be hit first, or, if no corner is hit, print out SENILE
.
The fire ball travels at a speed such that 1 unit is traversed in one life time. The corners are labelled in clockwise manner - is , is , is , is , is , is , is and is .
You may also like to know that Gandalf can do this problem using a signed 32-bit integer for his calculations.
Input Specification
Each test case consists of a line with 3 integers - , , and .
There will be multiple test cases; the last test case will simply have
.
Output Specification
Print which corner would be hit first, or SENILE
.
Sample Input
1 1 1
-1 -1 -1
Sample Output
7
Comments