时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
YZ is the king of the kingdom. There are n cities in his kingdom. To celebrate the 50th anniversary of the founding of his country, YZ decided to distribute supplies as a reward to all the cities.
We all know that the further the city is from the capital (always at 1), the more it will cost to transport. We define K as the shortest distance between a city and the capital, and ignore the difference in distance between different cities(all is 1 unit). Cost from capital to the city is
.
Now YZ gives you the map of his kingdom, and asks you if you can calculate the total cost.
(We guarantee that it is a connected graph.)
输入描述:
The first line contains two integers n and m
*n%2F2)))
, which means there are n cities and m roads.
The next m lines contains two integers u and v, denoting there is a road connecting city u and city v.
输出描述:
Print the only line containing a single integer. It should be equal to the total cost mod 1e9+7.
示例2
输入
复制
7 6
1 2
1 3
1 4
3 5
3 6
4 7