Road network
In a small, but very proud country there are n military bases. King decided to connect them with roads so that one can move from any base to any other along one or more roads. An interesting feature of this country is that engineers can build only the roads moving either from north to south or from east to west. King instructed the Minister of Transport to make a plan, and he, in turn, gave this assignment to you - the High Programmer of the state. You need to determine the minimum total length of the roads in the constructed road network.
The country is represented with Cartesian coordinate system. The axis Ox goes from west to east, and the axis Oy goes from south to north. The base sizes are quite small, so they can be considered as points, and the road as lines in the plane.
Input
The first line contains the number of bases n (1 ≤ n ≤ 10). Each of the next n lines contains the coordinates of one base in format "x y", where x is the abscissa, y is an ordinate, x and y are integers from -1000 to 1000 inclusive.
Output
Print one number - the total length of all built roads with 3 digits after the digital point.
Examples
Note
Possible locations for the best road networks for the above examples are provided below: