시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 512 MB1533100.000%

문제

There is a classic problem about finding two closest points amongst a set of points on a plane. There is also a classic randomized algorithm to solve it, which goes like this:

rotate the plane around the origin by a random angle phi
let p be the array of points
sort p by x coordinate in increasing order
ans = INF;
for (int i = 0; i < n; i++) {
    for (int j = i - 1; j >= 0; j--) {
        if (p[i].x - p[j].x >= ans) break;
        ans = min(ans, dist(p[i], p[j]));
    }
}

Here “INF” is some number greater than all distances. The function “dist” returns Euclidean distance between the given points. Note that all x coordinates are distinct after rotation with probability 1.

I know that the algorithm works well in practice, but how well exactly? I ask you to compute the expected number of calls of the function “dist”, assuming that the angle “phi” is chosen uniformly at random from the range [0; 2 · π).

입력

The first line contains a single integer n (2 ≤ n ≤ 250) — the number of points.

The next n lines contains coordinates of points, one per line.

All the coordinates are not greater than 106 by absolute value.

It is guaranteed that all points are distinct. It is guaranteed that no three points lie on the same line.

출력

Print one number — the expected number of calls of the function “dist”.

Your answer is considered correct if its absolute or relative error does not exceed 10−6.

예제 입력 1

4
0 0
0 1
1 0
1 1

예제 출력 1

5.0000000000000

예제 입력 2

3
0 0
0 1
1 0

예제 출력 2

2.5000000000000