We are in the year 1308. The burgrave of Nuremberg comes to the conclusion that the winding streets of the city are a mess. Thus, he plans to rebuild the whole city in a much larger space with rectangular streets that are parallel to his favourite coordinate system. 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 re - more important people rst. Note that importance is not the same as reputation: e.g. whereas people working in nance 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 i and importance j in the corresponding square with coordinates [i, i + 1[×[j, j + 1[, where i and j are integers. No two guilds share the same pair (i, j). 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 nd 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 gure on the next page). Input The input consists of several test cases, separated from each other by a blank line. The rst line of each test case holds an integer n, 2 ≤ n ≤ 100800. Each of the following n lines contains the coordinates of one house as two decimal numbers 0 ≤ x, y < 10, separated by one space. x, y may have up to 8 decimal places. Coordinates of some houses may be identical: this corresponds to multi-family houses. Figure 1 — The example city map (clipped) illustrates the last sample input, i.e. 9 quarters/guilds, 6 houses,and all admissible paths.
2/2 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 8 digits after the decimal point. As the streets are rectangular and parallel to the coordinate axes, you have to use the Manhattan or l1 -distance for the length of an individual path, i.e. the length of the path (x1, y1) → (x2, y2) is |x1 − x2| + |y1 − y2|. It is guaranteed that there is at least one admissible path. Sample Input 2 00 11 4 00 1.5 1.7 1.5 1.7 00 3 0.2 0.2 1.2 1.2 2.3 0.5 6 21 00 0 1.5 1.2 1.2 2.5 2.1 0.5 1.7 Sample Output 2.00000000 3.20000000 2.00000000 2.95000000