eolymp
bolt
Try our new interface for solving problems
Problems

The mutual arrangement of lines

The mutual arrangement of lines

No matter who \textbf{N.} sits at the point \textbf{a} a straight line and is able to crawl at a speed \textbf{V.} On the other, or the first line at the point \textbf{b} lies no matter what \textbf{X.}, passionately desired \textbf{N.} Help \textbf{N.} determine the time that he needed to get to \textbf{X.} Please note that N. at any time should remain one of the two lines. \InputFile The input file contains 5 lines: \begin{itemize} \item six numbers \textbf{x_11}, \textbf{y_11}, \textbf{z_11}, \textbf{x_12}, \textbf{y_12}, \textbf{z_12} --- the coordinates of two different points of the first direct \item six numbers \textbf{x_21}, \textbf{y_21}, \textbf{z_21}, \textbf{x_22}, \textbf{y_22}, \textbf{z_22} --- the coordinates of two different points in the second line \item three numbers \textbf{a_1}, \textbf{b_1}, \textbf{c_1} --- the coordinates of \textbf{N}. \item three numbers \textbf{a_2}, \textbf{b_2}, \textbf{c_2} --- the coordinates of \textbf{X}. \item \textbf{V} --- velocity of \textbf{N}. \end{itemize} All numbers are integers, not exceeding modulo \textbf{10^6}. Guaranteed that both \textbf{N.}, and \textbf{X.} are each in one of the lines. \OutputFile Minimum time required \textbf{N.}, to get to \textbf{X.} Result output with five characters after the decimal point. If \textbf{N.} reach \textbf{X.} not be able to output to the output file number "\textbf{-1}".
Time limit 2 seconds
Memory limit 256 MiB
Input example #1
0 0 0 5 5 5
6 6 6 9 9 9
0 0 0
10 10 10
1
Output example #1
17.32051
Author Stanislav Pak
Source Winter School, Kharkov, 2011, Day 1