PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000389. Bowling có hàng rào (Fence Bowling)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

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 ww and length ℓ\ell. Rails along the sides make the ball bounce back into the lane. A throw is valid only if the ball bounces exactly kk times before reaching the far end. If the incident angle measured from the rail normal is α\alpha, the outgoing angle from the normal is arctan⁡(2tan⁡α)\arctan(2\tan\alpha). The ball starts at the midpoint of the near end and must reach the midpoint of the far end. Determine the initial angle β\beta from the rail normal, in degrees, between 00 and 9090.

Two-bounce example

Input

One line contains three integers k,w,ℓk,w,\ell: bounce count, lane width and lane length, respectively.

Output

Print the angle β\beta in degrees. Absolute or relative error at most 10−610^{-6} is accepted.

Subtasks

  • Subtask 1 (20 points): 1≤k≤11\le k\le 1; 1≤w,ℓ≤1001\le w,\ell\le100.
  • Subtask 2 (30 points): 1≤k≤31\le k\le 3; 1≤w,ℓ≤1001\le w,\ell\le100.
  • Subtask 3 (50 points): 1≤k≤101\le k\le 10; 1≤w,ℓ≤1001\le w,\ell\le100.

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.