Consider two infinite horizontal lines and , separated units apart. The line has points at the abscissae . The line has points at the abscissae . Given different indices choosen from , and different indices choosen from , define as the Euclidean distance between and , that is,
You are given , , and the points in and in . Pick and in order to
minimize
Input consists of several cases, each one with only integer numbers. Every case begins with four strictly positive numbers , , and . Follow . Follow . Assume , , and that the absolute value of each abscissa is at most .
Additionally, assume that and are at most .
For every case, print the result with four digits after the decimal
point. If you use the long double type, the input cases
have no precision issues.
Input
1 1 2 2 5 10 9 20 1 2 2 2 5 10 9 20 1000000 4 5 4 300000 300000 300000 300000 300000 -500000 -500000 -500000 -500000 3 2 7 4 0 2 4 6 8 10 12 1 4 7 10
Output
1.4142 10.0499 1280624.8475 3.0000