You are given 2 integers (N,M), N is the number of vertices, M is the number of edges. You'll also be given ai , bi, wi where ai and bi represents an edge from a vertex ai to a vertex bi and wi respresents the weight of that edge.
Task is to find the shortest path from source vertex (vertex number 1) to all other vertices (vi) where (2≤i≤N).
Input:
First line contains two space separated integers, (N,M) Then M lines follow, each line has 3 space separated integers ai , bi, wi.
Output:
Print the shortest distances from the source vertex (vertex number 1) to all other vertices (vi) where (2≤i≤N). Print "109" in case the vertex "vi" can't be reached form the source vertex.
Leave a space between any 2 printed numbers.
Constraints:
(1≤N≤104)
(1≤M≤106)
(1≤ai,bi≤N)
(1≤wi≤1000)