The monkeys at the zoo of Pordenone have trees (numbered from to ) to play on, with suspended bridges connecting some pairs of them. The bridges are numbered from to , and bridge connects trees and bidirectionally. There is at most one bridge between any pair of trees, and it is possible to get from tree to every other tree by crossing bridges.
The distance between two tress is the minimum number of bridges one has to cross to get from one tree to the other (without touching the ground).
Alessandro, the zookeeper, wants to add a new bridge to make the monkey area fancier. However, he is facing a problem: the monkey sitting on tree and the one sitting on tree are sworn enemies, and if he were to make them fight he would be fired instantly. The monkeys would fight if, after installing the new bridge, the distance between tree and was less than before. Also, Alessandro is not allowed to install a bridge between two trees that are already directly connected by a bridge.
Task
How many possible choices are there for the new bridge that would not get Alessandro fired?
Input data
The input consists of:
- a line containing integers , .
- lines, the -th of which consisting of integers , .
Output data
The output must contain a single line consisting of a -bit integer , the number of ways to choose the location of the new bridge.
Constraints and clarifications
- for each
- It is possible to reach any other tree from tree by crossing bridges.
- There is at most one bridge between any pair of trees.
# | Points | Constraints |
---|---|---|
1 | 0 | Examples |
2 | 24 | , |
3 | 33 | |
4 | 43 | No additional constraints |
Example 1
stdin
5 5
0 1
1 2
0 2
2 3
3 4
stdout
1
Explanation
In this sample case, there are trees and bridges. Initially, it is possible to reach tree from tree by crossing bridges: .
- If Alessandro were to add a bridge between trees and it would be possible to reach tree by crossing bridge: .
- If he were to add a bridge between trees and it would be possible to reach tree by crossing bridges: .
- If he were to add a bridge between trees and it would be possible to reach tree by crossing bridges: .
- If he were to add a bridge between trees and it would not be possible to reach tree by crossing fewer than bridges.
- If he were to add a bridge between trees and it would be possible to reach tree by crossing bridges: .
The answer is therefore , since the only bridge that Alessandro could build without getting fired is .
Example 2
stdin
10 12
5 7
5 0
2 1
6 7
9 8
1 8
3 4
6 5
1 3
9 0
0 1
5 9
stdout
33