403657: GYM101234 D Forest Game

Memory Limit:0 MB Time Limit:4 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Forest Gametime limit per test4 secondsmemory limit per test512 mebibytesinputstandard inputoutputstandard output

Consider the following boring game about removing nodes from a forest. Initially, the forest contains only one tree with N nodes, and your initial score is 0. The game then goes as follows:

  1. If the forest is empty, the game is finished. Otherwise, you choose one node from the current forest uniformly at random.
  2. Your score increases by the size of the tree which your chosen node belongs to.
  3. Remove your chosen node and all edges connected to this node. Then proceed to step 1.

Please calculate the expected value of your final score multiplied by N!, modulo 109 + 7.

Input

The first line of input contains one integer N indicating the number of nodes in the initial tree.

Each of the following N - 1 lines contains two integers x and y, indicating that x-th node and y-th node are connected by an edge in the given tree. The nodes are numbered from 1 to N.

  • 1 ≤ N ≤ 105
  • 1 ≤ x, y ≤ N
  • the given graph is a tree
Output

Output one number: the expected value of the final score of this boring game multiplied by N!, modulo 109 + 7.

ExamplesInput
2
1 2
Output
6
Input
3
1 2
2 3
Output
34

加入题单

上一题 下一题 算法标签: