Dividing a field P83390


Statement
 

pdf   zip

image

When Jordi and Mireia married several years ago, they put their gold together to buy a circular field with a radius of 1000 meters. Jordi put JJ kg of gold, and Mireia put MM kg. Time has passed and they divorce, so they have decided to divide the field in such a way that each one receives an area proportional to the gold invested by he or she. They will use a rope of length LL meters, tie one extreme to the easternmost point, and use the other extreme to mark the limit of the fields. Since Jordi is a gentleman, he will settle for the left, worst shaped field, while Mireia will get the field to the right, painted green in the picture.

The problem you must solve is: given the amounts of gold JJ and MM, which must be the length LL of the rope?

Input

Input begins with the number of cases. Every case consists of two real numbers J[1,100]J \in [1, 100] and M[1,100]M \in [1, 100].

Output

For every case, print the length LL of the rope with four digits after the decimal point. The input cases have no precision issues.

Public test cases
  • Input

    2
    1 20
    10 6.420421
    

    Output

    1849.2414
    1000.0000
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++