import sys input = sys.stdin.readline from heapq import heappop,heappush N,R,C=list(map(int,input().split())) X=list(map(int,input().split())) Y=list(map(int,input().split())) Z=list(map(int,input().split())) S=list(map(int,input().split())) X.append(1<<63) Y.append(1<<63) Z.append(1<<63) S.append(1<<63) E=[[] for i in range(N+1)] for i in range(R): u,v,w,a,m=list(map(int,input().split())) u-=1 v-=1 E[u].append((v,w,a,m)) E[v].append((u,w,a,m)) DP=[[[1<<63]*(N+1) for i in range(2)] for j in range(3)] DP[0][0][0]=0 Q=[] Q.append((0,0,0,0)) while Q: time,car,ship,ind=heappop(Q) if DP[car][ship][ind]!=time: continue if car==0: if DP[1][ship][ind]>time+X[ind]: DP[1][ship][ind]=time+X[ind] heappush(Q,(DP[1][ship][ind],1,ship,ind)) if DP[2][ship][ind]>time+Y[ind]: DP[2][ship][ind]=time+Y[ind] heappush(Q,(DP[2][ship][ind],2,ship,ind)) if car==1: if DP[2][ship][ind]>time+Y[ind]: DP[2][ship][ind]=time+Y[ind] heappush(Q,(DP[2][ship][ind],2,ship,ind)) if ship==0: if DP[car][1][ind]>time+Z[ind]: DP[car][1][ind]=time+Z[ind] heappush(Q,(DP[car][1][ind],car,1,ind)) for to,w,a,m in E[ind]: if DP[car][ship][to]>time+w: DP[car][ship][to]=time+w heappush(Q,(DP[car][ship][to],car,ship,to)) if car>=1 and DP[car][ship][to]>time+a: DP[car][ship][to]=time+a heappush(Q,(DP[car][ship][to],car,ship,to)) if car==2 and DP[car][ship][to]>time+m: DP[car][ship][to]=time+m heappush(Q,(DP[car][ship][to],car,ship,to)) if ship==1: if ind!=N: if DP[car][ship][N]>time+S[ind]+C/2: DP[car][ship][N]=time+S[ind]+C/2 heappush(Q,(DP[car][ship][N],car,ship,N)) else: for i in range(N): if DP[car][ship][i]>time+S[i]+C/2: DP[car][ship][i]=time+S[i]+C/2 heappush(Q,(DP[car][ship][i],car,ship,i)) ANS=1<<63 for i in range(3): for j in range(2): ANS=min(ANS,DP[i][j][N-1]) print(round(ANS))