M. Mira and the Random DFS

Time limit: 0.5sMemory limit: 256MBInput: Output:

Mira is exploring an ancient kingdom whose nn rooms are connected by n−1n-1 corridors. Every room is reachable from every other room, so the corridors form a tree. The rooms are numbered from 11 to nn, and Mira begins in room 11.

Mira records each room's number the first time she visits it. From every room, she explores its children in a uniformly random order: every permutation of the children is equally likely. The random orders chosen at different rooms are independent.

More precisely, Mira performs the following procedure on the tree rooted at room 11:

DFS(v):
    append v to p
    shuffle the children of v uniformly at random
    for each child u of v, in that order:
        DFS(u)

After the procedure finishes, the recorded sequence pp is a permutation of the integers from 11 to nn.

An inversion is a pair of positions (i,j)(i,j) such that 1≤i<j≤n1 \le i < j \le n and pi>pjp_i > p_j.

Find the expected number of inversions in the resulting permutation.

It can be shown that the answer is always an integer or an integer plus 0.50.5. Print the exact answer with one digit after the decimal point.

Input

The first line contains a single integer nn (1≤n≤2⋅1051 \le n \le 2 \cdot 10^5) --- the number of rooms.

Each of the next n−1n-1 lines contains two integers uu and vv (1≤u,v≤n1 \le u,v \le n, u≠vu \ne v), representing a corridor between rooms uu and vv.

It is guaranteed that the corridors form a tree, rooted at vertex 11.

Output

Print the expected number of inversions in the DFS permutation, with exactly one digit after the decimal point.

Example

stdin

4
1 3
3 2
3 4

stdout

1.5

Note

In the example, the only possible DFS orders are (1,3,2,4)(1, 3, 2, 4) and (1,3,4,2)(1, 3, 4, 2). The first one has 11 inversion: 3>23 > 2. The second one has 22 inversions: 3>23 > 2 and 4>24 > 2. As these two orders are equally likely, the expected number of inversions is 1+22=1.5\frac{1 + 2}{2} = 1.5.

Log In or Sign Up to be able to send submissions!