Under construction

Still being built. Things may change

Short Random Problem

Time limit6sMemory limit512 MB

Summary
Given a tree whose edge lengths are independent uniform random reals in [0, 1], find the expected diameter modulo 10^9+7.
Level

Hard9 of 10

Topics
Tree, Probability, Dynamic programming, Combinatorics
Solved
No attempts yet

Problem

This contest has many other problems besides this one, so let us keep it short.

You are given a tree with nn vertices. The length of each edge is a real number chosen independently and uniformly at random between 00 and 11. Find the expected value of the diameter of this tree.

Input

The first line contains one integer nn (2≤n≤1002 \leq n \leq 100), the number of vertices.

Each of the next n−1n-1 lines contains two integers uiu_i, viv_i (1≤ui,vi≤n1 \leq u_i, v_i \leq n, ui≠viu_i \neq v_i), the endpoints of the ii-th edge.

Output

Print the answer modulo 109+710^9 + 7. The expected diameter is a rational number pq\frac{p}{q} with pp and qq coprime, and qq is not divisible by 109+710^9 + 7. Print the integer aa between 00 and 109+610^9 + 6 such that p−aqp - aq is divisible by 109+710^9 + 7.

Examples2

  1. Example 1

    Input
    5
    1 2
    2 3
    3 4
    4 5
    
    Expected output
    2
    
  2. Example 2

    Input
    5
    4 2
    2 3
    3 1
    3 5
    
    Expected output
    283333337