import heapq n,m,X=map(int,input().split()) edge=[tuple(map(int,input().split())) for _ in range(m)] E=[[] for _ in range(n+1)] for u,v,a,b in edge: E[u].append((v,a,b)) E[v].append((u,a,b)) def f(w): D=[10**19]*(n+1) D[1]=0 q=[(0,1)] while q: d,x=heapq.heappop(q) if x==n:break if D[x]