eolymp
bolt
Try our new interface for solving problems
Problems

Cylinder

Cylinder

Consider the doubly infinite cylinder whose axis passes through the center of the Cartesian coordinate system, the radius \textbf{R}. In this problem you need to calculate the surface area of a ball centered at \textbf{c} of radius \textbf{r}, which is contained in the cylinder. \InputFile The first line contains four numbers \textbf{r}, \textbf{x_c}, \textbf{y_c}, \textbf{z_c} --- radius of the sphere and the coordinates of its center. The second line contains four numbers \textbf{R}, \textbf{x_v}, \textbf{y_v}, \textbf{z_v} --- cylinder radius and the coordinates of points on its axis (not the same origin). All numbers are integers, do not exceed the absolute value of \textbf{1000}, the radii are positive. \OutputFile Bring out a single number - the surface area of the ball that has fallen into the interior of the cylinder, with an accuracy of less than \textbf{4} decimal places.
Time limit 2 seconds
Memory limit 256 MiB
Input example #1
10 100 0 0
5 1 0 0
Output example #1
168.357443
Author Stanislav Pak
Source Winter School, Kharkov, 2011, Day 1