favorite We need a little bit of your help to keep things running, click on this banner to learn more
Problems

# The distance from the point to the segment

Givena segmentinspace (x1, y1, z1) - (x2, y2, z2) and thepoint (x, y, z). Find thedistancefrom thepointtothe segment.

Input

Givenintegersx1, y1, z1, x2, y2, z2, x, y, z. Coordinatesdo not exceed1000.

Output

Bring out thedesiredquantitycupat least 6digits afterthe decimal point.

Time limit 1 second
Memory limit 256 MiB
Input example #1
0 0 0
1 1 1
0 0 1

Output example #1
0.8164965809

Author Stanislav Pak
Source Winter School, Kharkov, 2011, Day 1