Compulsory Lanterns
A courier network has cities and directed roads. Each road has a positive length.
A route from city to city is eligible if its total length is as small as possible among all directed routes from city to city .
For a destination , a city is a compulsory lantern for if both of the following conditions hold:
- and .
- Every eligible route from city to city passes through city .
City has lantern value . For every city , find the total value of all compulsory lanterns for . If city cannot be reached from city , this total is .
Input
The first line contains two integers and (, ), the number of cities and roads.
Output
Print one line containing integers . For each with , must be the total value of all compulsory lanterns for city . Consecutive integers must be separated by one space.
Samples
Sample 1
Input
5 6 0 5 7 11 13 1 2 1 2 4 1 1 3 1 3 4 1 4 5 1 2 5 5
Output
0 0 0 0 11
For city , every eligible route passes through city . City is not compulsory for itself, and cities and are not compulsory for city because either one can be avoided by an eligible route.