Problem D: Laser Pointer

Jake and his friends have been walking around a house of mirrors at a carnival for quite some time now. While Jake's friends are still interested in seeing a few rooms, Jake is quite bored. He decides to wait by the exit while the rest of them search the remainder of the house. Jake also has a laser pointer which he plays with to help pass the time.

The exit is located at the end of a hallway of length L and width W where 0 < L,W ≤ 10,000. The walls along the length of the hallway are lined with mirrors. Jake is at the start of the hallway and is leaning against the right wall. He shines his laser pointer toward the exit making an angle (in degrees) of 0 ≤ θ < 90 with the right wall.

The laser beam travels some distance A, perhaps reflecting off one or more walls, until it illuminates a spot at the end of the hall on the exit door. In his boredom, Jake wonders how much further this beam travelled than if he had shone the laser pointer directly at the spot on the door. That is, if the Euclidean distance from the laser pointer to the illuminated point on the wall is B, Jake is trying to determine the ratio A/B.

The first line of input indicates how many test cases follow. Each test case consists of three integers L, W, and θ on one line.

The output for each test case is a single line containing the value A/B rounded to three decimal places.

Sample input

2
10 5 45
12 12 75

Output for sample input

1.414
3.732

Zachary Friggstad