URI Online Judge | 2773

Shortest Path

By Yuri Cardoso Santamarina, UFU BR Brazil

Timelimit: 1

Joãozinho likes to attend classes and wants to spend as little time as possible on the way from his home to the place of his class. It is known that he walks at a speed of V meters per second and that there is a vacant lot between his house and his school that can not be used to cut way. Knowing this, what is the least time, in seconds, for Joãozinho to complete the journey? Consider the situation in the 2D plane, where Joãozinhos's house is at the point (Xi, Yi), the school at point (Xf, Yf), the lower left point on the terrain at point (X1, Y1), and the upper right at point (Xr, Yr). The terrain has its sides parallel to the X and Y axes and it is guaranteed that Xi < Xl, Xr < Xf, Yl \(\leq\) Yi, Yf \(\leq\) Yr, that is, Joãozinho's house is to the left of the terrain, the school to the right, and Joãozinho will need to get around part of the land to get to school.

Input

The input is composed of several test cases and ends with EOF.
The first line of a case contains 5 integers Xi, Yi, Xf, Yf and V representing the coordinates of Joãozinho's house and his school and Joãozinho's speed in meters per second.
The second line also contains 4 integers Xi, Yi, Xr and Yr, representing the lower left corner of the terrain and the upper right corner. (\(0 \leq Xi, Yi \leq 10^6\), \(1 \leq V \leq 10^2\)).

Output

For each test case, print a floating-point formatted with one decimal place, representing the least time for Joãozinho to get to his school without going into the terrain. Joãozinho can walk on the edge of the terrain.

Input Sample Output Sample

0 2 8 2 5
3 1 6 4
0 2 8 1 5
3 1 6 4

1.7
1.6