Statement
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.
Input
The input is given in the following format:
Each case is given in the following format:
For each , there is an edge between vertices and .
Output
For each case, print the number of vertex pairs for which Alice wins on its own line.
Constraints
- .
- .
- ().
- The given edges form a tree.
- The sum of over all cases is at most .
Subtasks
Samples
- In the first case, there is only one vertex, so no pair of distinct vertices can be chosen. The answer is .
- In the second case, the only pair for which Alice wins is . The token at vertex cannot move down, so Bob loses on his first turn.
- In the third case, the pairs for which Alice wins are and . Both pairs contain vertex , so Bob loses on his first turn. For the remaining pair , Bob moves the tokens to vertices and , respectively, and Alice loses on her next turn.
- In the fourth case, the pairs for which Alice wins are , , , , , and . Every pair contains at least one vertex with no children, so Bob loses on his first turn.