- Time limit: 1.00 s
- Memory limit: 512 MB
There are cities and flight connections between them. Your task is to determine the length of the shortest route from Syrjälä to every city.
Input
The first input line has two integers and : the number of cities and flight connections. The cities are numbered , and city is Syrjälä.
After that, there are lines describing the flight connections. Each line has three integers , and : a flight begins at city , ends at city , and its length is . Each flight is a one-way flight.
You can assume that it is possible to travel from Syrjälä to all other cities.
Output
Print integers: the shortest route lengths from Syrjälä to cities .
Constraints
Example
Input:
3 4 1 2 6 1 3 2 3 2 3 1 3 4
Output:
0 5 2