E - Moon Silhouettes 

Context

On the 28th January 2013, Australian photographer Mark Gee captured these amazing pictures of silhouettes of people in front of the full Moon.

Moon
Full Moon silhouettes by Mark Gee

But, how can you make the Moon look so big? Basically, all you have to do is go far away from the people and take the picture using a very large zoom. For example, the previous picture was taken 2.1 km away from the people, and using a zoom with a field of view of approximately 1.906º.

The Problem

We want to take some Moon silhouettes pictures, with different sizes of the people and the Moon in the images. We have the following parameters: image size in pixels (width, height), the desired size of the Moon in the images (diameter, in pixels), and the desired height of people in the images (also in pixels).

You have to compute the distance we must go away from the people, and the field of view of the zoom that we must use. The distance should be given in kilometers with two decimal digits. The field of view is the angle of vision across the vertical direction, and should be given in degrees with 3 decimal digits.

You have to assume that: (i) the distance from any part of the Earth to the Moon is always 384000 km, assuming also that the Earth is flat; (ii) the diameter of the Moon is 3476 km; and (iii) the height of people is always 1.8 m.

For example, the previous image size is 399 x 276 pixels; the diameter of the Moon in the image is 272 pixles; and people appear with a height of 25 pixels. Therefore, the distance to the people should be 2.16348 km, and the field of view 0.52626962º, that should be expressed as 2.16 and 0.526, respectively.

The Input

The input can contain several test cases. The first line of the input indicates the number of test cases.

Each test case is described in a line with four integer values: image width, image height, the desired diameter of the Moon in the image, and the desired height of people in the image. All these values are given in pixels.

The Output

For each test case, you have to output a line with two values separated with a blank space: the distance to the people (given in kilometers, with 2 decimal digits), and the field of view (given in degrees, with 3 decimal digits). The ommited decimal digits have to be truncated; for example, the field of view 0.52626962 is truncated to 0.526; the distance 2.16348 is truncated to 2.16; and a distance of 3.9999 would be truncated to 3.99.

Sample Input

3
399 276 272 25
640 480 311 48
3000 2000 66 356

Sample Output

2.16 0.526
1.28 0.8
0.03 15.619

OMP'13
Facultad de Informatica
Universidad de Murcia (SPAIN)