CHOTU - Faridi and Yadav

Once it happened that the two scientists (perhaps mad) Mr Yadav and Mr Faridi discovered an unusual radioactive compound named mahobanium, that decays at constant rate. And as the compound decays it loses weight. The two of them start playing a game, in which both of them sit at equal distance from a point C, one sits to the west and the other to the east. Being famous scientists a lot of students have come to see them (basically not to see them but the compound, they had discovered). The students have gathered around the two. The scientist also have a small robot, named CHOTU.

Initially Mr Faridi has all the stones of mahobanium compound with him and all have equal weight. Faridi gives stones (one at a time) to CHOTU and directs him to show the compound to one of the student (who hasn't seen the compound yet) and then immediately go towards Mr Yadav. (Assume no loss of time in showing the stone to students, also CHOTU follows the shortest path while moving and always runs at same speed = 5m/s). The students, actually have placed themselves in such a way that all the stones that have reached Yadav have the same weight. (Assume that radioactive decay starts as soon as it is placed in CHOTU's hand). A child can place itself to at most distance of X units from the centre along east or west, and to at most distance of Y units from the centre C along north or south.

Given test cases t (< 1000) the values of X and Y (say X > Y) and (X < 1000), scratch your brain to find out the maximum distance that can exist between Mr Yadav and Faridi so that above conditions are always followed. Print your answer with 3 decimal places.

Input

First Line has number of test cases t.

The next t lines have two integers X and Y separated by space [the values of X and Y (say X > Y) and (X < 1000)].

Output

Print the required answer with 3 decimal places.

Sample

Input
1
4 2

Output
6.928

Added by:aqfaridi
Date:2014-01-19
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own

hide comments
2016-06-23 10:54:11
Nice Question on Geometry!!
2016-06-20 14:07:23
simple geometry :-) but nice ques. !!
2016-03-16 02:52:31 minhthai
heavy spoiler in the comments ...
2015-12-11 15:53:45
@dungeon_master no spoilers please!!!!
anyways awesome problem......:)
2015-12-06 08:37:21 Siddharth Singh
problem description isnt good @ all,
just think they are at the same line.
and use simple geometry
2015-08-23 19:45:36 abhinav vinci
yo :: all you need is an egg
thanks OneMoreError
2015-08-06 16:29:43 BadeMeow
Problem Description not so good.
My 100th! :D
2015-08-02 06:57:05 Anant Upadhyay
use double instead of float
2015-05-31 08:31:47 OneMoreError
Hint : all u need is an egg :)
2015-03-29 16:01:22 srishty
does the question itself imply that x will always be gtraeter then y??
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.