import heapq N=int(input()) C=int(input()) V=int(input()) S=list(map(int,input().split())) T=list(map(int,input().split())) Y=list(map(int,input().split())) M=list(map(int,input().split())) E=[[] for i in range(N+1)] for i in range(V): E[S[i]].append((T[i],Y[i],M[i])) E[T[i]].append((S[i],Y[i],M[i])) DP=[[1<<30]*(C+1) for i in range(N+1)] DP[1][C]=0 Q=[(0,1,C)] while Q: now,town,money=heapq.heappop(Q) if now>DP[town][money]: continue for to,y,m in E[town]: if money-y>=0 and DP[to][money-y]>now+m: DP[to][money-y]=now+m heapq.heappush(Q,(now+m,to,money-y)) MIN=min(DP[N]) if MIN==1<<30: print(-1) else: print(MIN)