One day, Sil dreamed of a ”magic mirror”. Unlike normal mirrors, this type of mirror not only reflflects the image of the object, but also creates a copy of the object at the symmetric place behind the mirror. Object will be copied no matter if there’s something between the magic mirror and the object, unless
the object is another mirror. Notice that the copies can also be copied by the magic mirror, but a magic mirror will never be copied by another magic mirror.
In Sil’s dream, there’re two giant magic mirrors standing on an infifinite platform. Both have mirror surfaces on each side of them. The mirrors are so large that they can be recognized as two walls of infifinite length.
When Sil was stranded in front of the mirrors at (px, py), there appeared so many copies of Sil! Now Sil wants to go to a specifific place at (qx, qy), can you tell him what’s the minimum distance between Sil or one copy of Sil and the target place?
输入描述:
The fifirst line contains an integer T(1 ≤ T ≤ 2 × 105 ), indicating the number of test cases.
Each test case contains three lines. In the fifirst line, there are three integers A1, B1, C1(−109 ≤ A1, B1, C1 ≤ 109 ) denoting a magic mirror which can be recognized as a line A1x + B1y + C1 = 0. In the second line, there are three integers A2, B2, C2(−109 ≤ A2, B2, C2 ≤ 109 ) denoting another magic mirror. In the third line, there are four integers px, py, qx, qy(−109 ≤ px, py, qx, qy ≤ 109) denoting the position of Sil and the position he wants to go.
输出描述:
For each test case, output a real number in a single line, indicating the minimum distance between Sil or one copy of Sil and the target place. Your answer will be considered correct if the relative or absolute error between yours and the standard solution is not greater than 10−6 .
示例1
输入
复制
3
1 0 0
0 1 0
2 2 -3 -1
1 0 0
1 0 -1
2 2 -3 -1
1 2 0
3 4 0
2 2 -3 -1
输出
复制
1.4142135624
3.1622776602
0.3338505354