Energy Production

Limits 1s, 512 MB

The famous astronaut Roddur Roy has reached an unknown planet by losing his way. Now he needs a lot of energy to restart his rocket and come back. Sadly, sunlight does not reach on this planet. But there is a strange intense light source, and he has a machine to collect energy from light.

He used a rectangular mirror of four walls to reduce the intensity of light. Mr Roddur calculated that the ray becomes useful after reflecting exactly $K$ times on the wall. He notices that the speed of producing energy increases if light travels less. To minimize the distance, he adjusts the direction of source light. But he is unable to calculate the total distance. Can you help him find the shortest distance the light has to travel to reach the machine?

Note:

Input

The first line contains a positive integer $T (T \leq 1000)$ — the number of test cases.

Each test case contains $7$ integers — $K, A, B, x_1, y_1, x_2, y_2 (0 \leq K \leq 1000, 2 \leq A \leq 1000, 2 \leq B \leq 1000, 0 < x_1 < A, 0 < y_1 < B, 0 < x_2 < A, 0 < y_2 < B)$, representing the number of reflection ($K$), size of the rectangle (length $A$, width $B$), position of source light $(x_1,y_1)$, position of machine $(x_2,y_2)$.

Output

For each test case, output a single line consisting of the shortest distance the light will travel, corrected to 2 decimal places.

Sample

InputOutput
3
1 100 100 1 1 1 1
2 100 3 50 1 50 2
2 100 100 1 1 1 1
2.00
5.00
2.83