Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 3015
Collision Ball Game

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Collision ball game is one of my favorite game when I was young. I was so fond of this game that I nearly decided to be a physical scientist (But I am not now). Firstly I wanted to construct a problem to describe the whole process of this game. But it is too difficult for me and I hate being bsed by others for wrong data.

So I decide to make it easier, but maybe I will construct one next time.

Assume the game is in a triangle with the lower-right angle k (in degree) and height h. (see the picture)

The ball's initial place is in (0, a) and it eventually arrives at (b, 0) with collising the bevel edge only once. The two points (0, a) and (b, 0) will always be on the edge of the triangle.

You are to calculate the distance the ball pass. The process of collision obey the physical law. The angle of incidence equals to the angle of reflection.

Input

The input contains multiple test cases. Each test cases contain four number (all double). The first line is the angle of the triangle k (in degree, 0 < k < 90). The second line is the height h (h > 0). The third line is a. The fourth line is b (a, b >= 0).

Process to the end-of-file.

Output

For each test case print a single line that contains the distance the ball pass (rounded to 2 decimal places).

Sample Input

45
2
1
1

30
2
1
2.3094

Sample Output

2.00
2.89

Author: LIN, Jiaqiang
Source: ZOJ Monthly, August 2008
Submit    Status