Statement
Alice and Bob play All Falls Somewhere on a connected undirected graph with vertices and edges. The vertices are numbered from to , and initially there is one piece on every vertex.
First, Alice chooses her vertex . Then Bob chooses his vertex . The two chosen vertices must be distinct.
The game consists of turns. Alice acts on odd-numbered turns, and Bob acts on even-numbered turns. On turn , the active player chooses a vertex adjacent to vertex and moves every piece currently on vertex to the chosen vertex.
After all turns, Alice's score is the number of pieces on vertex , and Bob's score is the number of pieces on vertex . Alice maximizes Alice's score minus Bob's score, while Bob minimizes this value.
Count the ordered pairs of distinct vertices for which Alice's score is greater than Bob's score when both players play optimally.
Input
The input is given in the following format:
Output
For each test case, print the number of ordered pairs satisfying the condition.
Constraints
- .
- .
- .