ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

USU Personal Contest 2001

About     Problems     Submit solution     Judge status     Standings
Contest is over

G. Thread in a Space

Time limit: 1.0 second
Memory limit: 64 MB
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.

Input

The first three lines contain coordinates of the points A, B and C respectively. The fourth one contains a radius R of the ball.

Output

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.

Sample

inputoutput
0 0 12
12 0 0
10 0 10
10
19.71
Problem Author: Alexander Mironenko
Problem Source: Ural State Univerisity Personal Contest Online February'2001 Students Session
To submit the solution for this problem go to the Problem set: 1075. Thread in a Space