You are given a tree, that is, an undirected, connected graph with no cycles. Can you count how many (non-empty) connected subgraphs it contains?
Input consists of several trees, each one with the number of vertices , followed by its edges. You can assume , that vertices are numbered between 0 and , and that the given edges indeed form a tree.
For every given tree, print its number of connected subgraphs. As this number may be large, make the computations modulo .
Input
1 2 1 0 3 2 0 1 2 4 0 3 0 2 0 1 4 3 2 2 1 1 0 7 1 6 0 4 4 2 4 3 4 6 3 5
Output
1 3 6 11 10 44