It is well known that craftsmen belonging to different guilds should better be living in
separate quarters of the city. Of course not all guilds have the same reputation and
the quarters for the guilds are to be ordered by reputation. The quarters
should also be ordered by the importance for the economy of the city, just
to be able to evacuate - in case of an enemy attack or a fire - more
important people first. Note that importance is not the same as
reputation: e.g. whereas people working in finance have about the lowest possible
reputation, they are still important for the economy of the city. In contrast,
clerics have a high reputation although the economy could do quite well without
them.
The burgrave places the quarter of a guild with reputation
and importance
in the corresponding square with coordinates
,
where
and
are integers. No two guilds share the same pair
.
The only problem is that the burgrave does not know how much to charge for the new postal
service. The price of every letter should be the same for all connections within the city. To find a fair price
that covers the transportation costs, the burgrave needs to know the average path length of all the mail. A survey has shown that all
connections are equally likely with the following exception: Nobody would ever
consider to write a letter to someone of a guild with lower or equal
reputation or importance than his own. We call a path between two houses
admissible if it is not excluded by this condition (see figure on the next page).
Input
The input consists of several test cases, separated from each other by a blank line. The first
line of each test case holds an integer
,
. Each of
the following
lines contains the coordinates of one house as two decimal
numbers
, separated by one space.
,
may have up to
decimal places. Coordinates of some houses may be identical: this
corresponds to multi-family houses.
Output
Your program should print one line for each test case and this line should
contain the average length of the admissible paths as a decimal number rounded
to
digits after the decimal point. As the streets are
rectangular and parallel to the coordinate axes, you have to use the
Manhattan or
-distance for the length of an individual path, i.e. the length of the
path
is
. It is
guaranteed that there is at least one admissible path.
|
Sample Input
4
0 0
1.5 1.7
1.5 1.7
0 0
3
0.2 0.2
1.2 1.2
2.3 0.5
6
2 1
0 0
0 1.5
1.2 1.2
2.5 2.1
0.5 1.7
Sample Output