#AGC058F. [AGC058F] Authentic Tree DP
[AGC058F] Authentic Tree DP
Score : points
Problem Statement
For an undirected tree , let us define a rational number as follows.
- Let be the number of vertices in .
- If : Let .
- If :- For an edge in , we denote by and the two trees that result from deleting from (in arbitrary order).
- Let .
- For an edge in , we denote by and the two trees that result from deleting from (in arbitrary order).
- Let .
You are given a tree with vertices numbered to . The -th edge connects Vertex and Vertex .
Find the value .
What is a rational number ?
Under the Constraints of this problem, when the sought rational number is represented as , it can be proved that . Therefore, there is a unique integer such that . Find this .
Constraints
- The given graph is a tree.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
We have .
We have .