Given a point with coordinates P_x P_y and a line segment , where the endpoints have coordinates A_x A_y and B_x B_y. The segment is guaranteed to be non-degenerate, meaning that and are distinct points.
Write a program to calculate the distance between the point and the segment .
Note: The distance between a point and a segment is defined as follows: if the point lies on the segment, the distance is zero; otherwise, it is the length of the shortest line segment that connects the point to any point on the segment.
Read the input from standard input (keyboard) in the format: P_x P_y A_x A_y B_x B_y (all on one line). All coordinates are integers and their absolute values do not exceed .
Output a single number representing the distance from the point to the segment. The result can be in exponential form or as a standard decimal fraction. The solution is considered correct if the error does not exceed 10^{-4}.
Example 1