402844: GYM100917 K Krotek
Description
Mole Krotek from famous Czech animation movie lives underground on 2D-plane on the depth ε .
Soon Krotek dug N tunnels for his new home. Each tunnel is the segment, given by coordinates of the endpoints. Tunnels can intersect each other only in the endpoint they share. No three endpoints are collinear.
Now Krotek wants to link all tunnels to the one network, connecting some of the existing endpoints by the new tunnels. New tunnels can intersect other new tunnels or the existing ones only in the endpoint they share.
Find out minimal total length of the new tunnels.
InputFirst line of the input contains one integer N (1 ≤ N ≤ 1000) — number of existing tunnels.
Each of the next N lines contain four integers (x1, y1, x2, y2) — coordinates of the endpoints of the one existing tunnel. Coordinates does not exceed 104 by absolute value.
You may assume that tunnels does not intersect (except for case when they share a endpoint) and that no three endpoints are collinear.
OutputPrint the minimum total length of the additional tunnels with absolute or relative error 10 - 6 or less.
ExampleInput2Output
0 0 3 0
0 1 1 2
1.0000000000