Circles in Hexagon :-)

It is often very difficult to find exact answers for some geometric problems with a straight forward formula. Often it is better to use iterative processes to solve these difficult problems. In this problem you are asked to find the minimum possible length of a side of a regular hexagon which can hold five and eight circles of equal radius. But you don?t have to discover the way. The following image shows how you can place five circles and eight of equal radius optimally in a regular hexagon. The arrangement of the circles in both the pictures is symmetric along AB. Fig.: Placing five and eight circles in a regular hexagon Input The first line of the input file contains a single integer N (0 < N ≤ 10000) which denotes the number of inputs. Each of the next N lines contains a floating point number r which denotes the radius of five circles. Output For each line of input you should produce one line of output. This output should contain two floating point numbers. They indicate the minimum possible length of a side of the regular hexagon in which five circles and eight circles of radius r can be kept without overlapping. All the output numbers should have 12 digits after the decimal point. You don’t need to worry about small precision errors (less than max (0.0000001%, 1e-9)) Sample Input 2 0.0000000001 0.0000000002 Sample Output 0.000000000300 0.000000000371 0.000000000600 0.000000000742