There are three points in a 3-dimensional space: A, B and C. All the coordinates of the points are integer numbers with absolute values not greater than 1000. A solid ball with a center in the point C is firmly fixed. A radius of the ball is R, a positive integer number. Distances from the point C to the points A and B are strictly greater than R.
It is necessary to stretch a thread of minimal length between points A and B. Surely, the thread should be outside of the ball.
You are to find out a length of the thread.
The first three lines contain coordinates of the points A, B and C respectively. The fourth one contains a radius R of the ball.
should contain a minimal length of the thread to within 2 symbols after a decimal point. You should output answer with two or more digits.
0 0 12
12 0 0
10 0 10
Problem Author: Alexander Mironenko
Problem Source: Ural State Univerisity Personal Contest Online February'2001 Students Session