N,M,X = map(int, input().split()) edge = [[] for i in range(N)] for i in range(M): u,v,c,t = map(int, input().split()) u-=1;v-=1 edge[u].append((v,t+c/X)) edge[v].append((u,t+c/X)) from heapq import *