There are two billiard balls on a carom table (billiard table without pockets) with length of $$$ l $$$ and width of $$$ w $$$. The balls are located at the points $$$(x_1, y_1)$$$ and $$$(x_2, y_2)$$$, where $$$ 1 \leq x_i \lt l, 1 \leq y_i \lt w $$$, and the coordinate axes go along the sides of the table (the abscissa axis is along the "long" side, the ordinate axis is along the "wide"). It is necessary to get the first ball into the second, contacting exactly three rail cushions. For simplicity, we will assume that the balls are points, the angle of reflection of the ball does not depend on the force of impact and is equal to the angle of hitting the cushion. When the ball hits exactly the corner, it is reflected strictly in the opposite direction, and it is considered that the ball hit both cushions forming the corner. A hit is considered to be an exact match of the coordinates of the points. Write a program that calculates the impact of the first ball, which, after reflecting off the rail cushions three times, hits the second one, and overcomes the minimum distance at the same time.
The first string contains two integers $$$ l $$$ and $$$ w $$$ ($$$ 2 \leq l, w \leq 1000 $$$) separated by a space. The second string contains four integers: $$$ x_1, y_1, x_2, y_2 $$$, separated by spaces – the positions of the first and second balls, respectively ($$$ 1 \leq x_i \lt l, 1 \leq y_i \lt w $$$).
Print a single number with an accuracy of $$$ 10^{-6} $$$ – the length of the trajectory of the optimal impact.
16 3 1 1 7 1
10.00000000
Optimal impact for the Example:
(1, 1) $$$\rightarrow$$$ (0, $$$\frac{1}{4}$$$) $$$\rightarrow$$$ ($$$\frac{1}{3}$$$, 0) $$$\rightarrow$$$ ($$$4\frac{1}{3}$$$, 3) $$$\rightarrow$$$ (7, 1)
Picture:

| Name |
|---|


