f=open("input.txt") d=f.readline().split() n=int(d[0]) m=[[1000000]*n for i in range(n)] for i in range(int(d[1])): d=map(int, f.readline().split()) m[d[0]-1][d[1]-1]=d[2] m[d[1]-1][d[0]-1]=d[2] for rida in m: print rida i=1 g={} g[0]=0 g[1]=m[0][1] g[2]=min(g[1]+m[1][2], m[0][2]) g[3]=min(g[2]+m[3][2], g[1]+m[1][2]) print g exit() ###### while i