Welcome to ZOJ
Select Problem
ZOJ Problem Set - 4071

Time Limit: 1 Second      Memory Limit: 65536 KB      Special Judge

Chiaki lives in a special universe where the the law of conservation of energy is quite different. Specifically, an equation $v^2+2gy=0$ can be found to describe the law, where $v$ is it's speed at point $(x, y)$ and $g$ is the gravitational acceleration which equals to $10$.

At first, Chiaki is at origin $(0,0)$ without any kinetic energy and she would like to go to some point $(x,y)$ by some pipes.

Chiaki has three pipes whose length are $l_1$, $l_2$ and $l_3$. She must use the pipes to build a tunnel, which is the route to the destination.

  • At least one pipe should be used, each pipe can only be used once and the pipe cannot be bent or cut off.
  • The tunnel must start from $(0,0)$ and end at the destination $(x,y)$.
  • The pipes must be connected end to end.

Chiaki would like to know whether it is possible to reach the destination and the minimum time to go to the destination if it is possible.


There are multiple test cases. The first line of the input contains an integer $T$ ($1 \le T \le 500$), indicating the number of test cases. For each test case:

The first line contains five integers $x$, $y$, $l_1$, $l_2$ and $l_3$ ($-1000 \le x, y \le 1000$, $1 \le l_1, l_2, l_3 \le 1000$) -- the coordinators of the destination and the length of each pipe.


For each test case, output an real number denoting the minimum time, or a string "Impossible!" (without the quotes) if Chiaki cannot reach the destination.

Your answer will be considered correct if and only if the absolute error or relative error of your answer is less than $10^{-8}$.

Sample Input

0 1 1 1 1
3 -4 2 3 3
-1000 0 499 499 3
0 -8 10 2 1000

Sample Output


Author: LIN, Xi
Source: Yet Another Xi Lin Contest
Submit    Status