Problems
Conic Distance
Conic Distance
A cone is located in \textbf{3D} such that its base of radius \textbf{r} is in the \textbf{z} = \textbf{0} plane with the center at (\textbf{0},\textbf{0},\textbf{0}). The tip of the cone is located at (\textbf{0}, \textbf{0}, \textbf{h}). Two points are given on the cone surface in conic coordinates. The conic coordinates of a point \textbf{p} lying on the surface of the cone are two numbers: the first, \textbf{d}, is the distance from the tip of the cone to \textbf{p} and the second, \textbf{A} < \textbf{360}, is the angle in degrees between the plane \textbf{y} = \textbf{0} and the plane through points (\textbf{0},\textbf{0},\textbf{0}), (\textbf{0},\textbf{0},\textbf{h}) and \textbf{p}, measured counterclockwise from the direction of the \textbf{x} axis.
\includegraphics{https://static.e-olymp.com/content/63/6389b87c766eb6bfc1ced600a3ab9dca6efbfb0a.jpg}
Given are two points \textbf{p_1} = (\textbf{d_1}, \textbf{A_1}) and \textbf{p_2} = (\textbf{d_2}, \textbf{A_2}) in the conic coordinates. What is the (shortest) distance between \textbf{p_1} and \textbf{p_2} measured on the surface of the cone?
\InputFile
The input is a sequence of lines. Each line contains 6 floating point numbers giving values of: \textbf{r}, \textbf{h}, \textbf{d}_1, \textbf{A}_1, \textbf{d}_2, and \textbf{A}_2.
\OutputFile
For each line of input, output the (shortest) distance between points \textbf{p_1} and \textbf{p_2} on the surface of the cone with the fraction rounded to \textbf{2} decimal places.
Input example #1
3.0 4.0 2.0 0.0 4.0 0.0 3.0 4.0 2.0 90.0 4.0 0.0 6.0 8.0 2.14 75.2 9.58 114.3 3.0 4.0 5.0 0.0 5.0 90.0
Output example #1
2.00 3.26 7.66 4.54