import math from heapq import heappush, heappop N = int(raw_input()) C = int(raw_input()) V = int(raw_input()) S = map(int, raw_input().split()) T = map(int, raw_input().split()) Y = map(int, raw_input().split()) M = map(int, raw_input().split()) adjList = [ [] for i in range(N) ] for (s,t,y,m) in zip(S,T,Y,M): adjList[s-1].append((t-1,y,m)) minDist = [7500000 for i in range(N)] heap = [] heappush(heap, (0,0,C) ) while len(heap) != 0: (time, pos, cost) = heappop(heap) if pos == N-1: print time exit() for (t,y,m) in adjList[pos]: if cost - y >= 0: heappush( heap, (time+m, t, cost-y) ) print -1