Alice and Bob are playing All Falls Down, a game in which two tokens fall down a tree. The board is a tree rooted at vertex , with each child placed below its parent.
First, Alice chooses two distinct vertices and places one token on each vertex.
Starting with Bob, the players then take turns. On a turn, the player must choose one child of the current vertex for each token and move both tokens simultaneously to the chosen children. In other words, both tokens must fall one level down. If either token cannot move farther down, the player whose turn it is loses.
Both players play optimally. Count the unordered pairs of distinct vertices for which Alice wins.
The input is given in the following format:
For each case, print the number of vertex pairs for which Alice wins on its own line.
Each case is given in the following format:
For each , there is an edge between vertices and .
| 3 | 20 | The tree is a path, and vertex is an endpoint of the path. |
| 4 | 45 | No additional constraints. |