eolymp
bolt
Try our new interface for solving problems

UFO

Time limit 1 second
Memory limit 64 MiB

There is a UFO in the form of the disc of radius r. Currently its center is in point A and it needs to move its center to point B as soon as possible. But the tricky inhabitants of the Earth are starting to suspect something, so they have built a redar in point C with a range of R, which is able to detect a UFO, if any part of it will be in the range. Because of the special features of the UFO it cannot change its height and always maintain vertical alignment. Determine the shortest path for the UFO to reach its destination not being caught by the radar.

Input data

The first line of input contains number T (1T1000) — the amount of test cases. Next T line consist of eight integers each x_A, y_A, x_B, y_B, x_C, y_C, (-1000x_A, y_A, x_B, y_B, x_C, y_C1000) r and R (0r, R1000) —the coordinates of points A, B, C and radii of the UFO and radar coverage. It is guaranteed that the UFO won't be within the radar coverage in points A and B.

Output data

For each test case output a real number which is the shortest UFO path with two decimals after the dot.

Examples

Input example #1
1
0 0 8 0 4 0 1 1
Output example #1
9.02