#BS0000389. Bowling có hàng rào (Fence Bowling)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Bowling có hàng rào (Fence Bowling)
Fence Bowling
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
Olav practises bowling on a lane of width and length . Rails along the sides make the ball bounce back into the lane. A throw is valid only if the ball bounces exactly times before reaching the far end. If the incident angle measured from the rail normal is , the outgoing angle from the normal is . The ball starts at the midpoint of the near end and must reach the midpoint of the far end. Determine the initial angle from the rail normal, in degrees, between and .

Input
One line contains three integers : bounce count, lane width and lane length, respectively.
Output
Print the angle in degrees. Absolute or relative error at most is accepted.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
2 8 27
Output
36.8698976
Explanation
The initial tangent is 0.75. Horizontal distances are 4, 8, 4 and slopes are 0.75, 1.5, 3. Longitudinal distances are 3, 12, 12, totaling 27 with two bounces.
Input
1 2 3
Output
45.0
Explanation
At 45 degrees the tangent is 1. The first segment moves 1 sideways and 1 forward. After bouncing, the final segment moves 1 sideways and 2 forward. The total is 3 with one bounce.