There are two starcrafts and a drop of water (nobody knows where it comes from) in a hyperspace (it’s well-known that hyperspace has 8 dimensions). Whereas there’re anisotropic distortions because of the hyperspace transfer you may assume the ships as points (A and B) and the drop as a sphere with radius R and center in the point C. Coordinates of all the points are integer and their absolute values don’t exceed 1000. The drop is motionless. The radius R is a positive integer not exceeding 3000. The distance from the point C to the points A and B is greater than R.
The starcraft B is distressed (and motionless as well), and the starcraft A hurries to succor. You are to find out the length of the short cut from the point A to the point B not crossing the sphere (the starcraft may move along the edge of the sphere).
Input
There are three lines in succession containing coordinates of the points A, B and C respectively. Each of the lines consists of 8 integers. The fourth line contains positive integer R, that is the sphere radius.
Output
Should contain the length of the short cut within 2 digits after a decimal point. There must be exactly 2 digits after a decimal point. The result is to be rounded according to the standard mathematical rules.
Sample
input | output |
---|
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0
10 10 10 10 5 5 5 5
3
| 1.00
|
Problem Author: Alexander Mironenko and Alexey Lakhtin
Problem Source: USU Personal Contest 2004