Two people walk straight lines at constant speeds over the same time span, and the program prints the smallest distance between them to ten decimal places.
Minho and Kangho are on a two dimensional coordinate plane. Minho walks from point A(Ax,Ay) toward point B(Bx,By), and Kangho walks from point C(Cx,Cy) toward point D(Dx,Dy). They start at the same moment, and Kangho reaches D at the same instant Minho reaches B. Each of them walks at a constant speed.
Write a program that finds the smallest distance between Minho and Kangho during the walk.
The distance between two points (x1,y1) and (x2,y2) is (x2−x1)2+(y2−y1)2.
Input
The first line contains Ax, Ay, Bx, By, Cx, Cy, Dx, Dy, separated by spaces. Every coordinate is an integer between 0 and 10000, inclusive.
A and B may be the same point, and C and D may be the same point. A walker whose two points are the same stands still.
Output
Print, on one line, the smallest distance between Minho and Kangho, rounded to the tenth digit after the decimal point. Pad with zeros so that exactly ten digits follow the decimal point.