A submarine is using a communications laser to send a message to a jet cruising overhead. The sea surface is flat. The submarine is cruising at a depth d below the surface. The jet is at height h above the sea surface, and a horizontal distance x from the sub. The submarine turns toward the jet before starting communications, but needs to know the angle of elevation, φ, at which to aim the laser.
When the laser passes from the sea into the air, it is refracted (its path is bent). The refraction is described by Snell's law, which says that light approaching the horizontal surface at an angle θ1, measured from the vertical, will leave at an angle θ2, given by the formula
sin θ1 / sin θ2 = n1 / n2
where n1 and n2 are the respective refraction indices of the water and air. (The refraction index of a material is inversely proportional to how fast light can travel through that material.)
Each test case consists of a single line of input containing 5 space-separated floating point numbers:
Input ends with a line containing 5 zeroes (0 0 0 0 0).
For each test case, print a single line containing the angle of elevation φ at which the submarine should aim its laser to illuminate the jet.
The angle should be displayed in degrees and rounded to the closest 1/100 of a degree. Exactly two digits after the decimal point should be displayed.
600 600 1000 1.333 1.01 600 1200 4000 1.5 1.01 400 100 10000 2.5 1.01 0 0 0 0 0
44.37 11.51 2.30