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())) edge = [[] for _ in range(N)] for i in range(V): edge[S[i]-1].append((T[i]-1,Y[i],M[i])) from collections import deque def clac(t): que = deque() que.append((0,0,0)) while que: i,c,m = que.popleft() for j in edge[i]: if j[1]+c <= C and j[2]+m<=t: if j[0] == N-1: return True que.append((j[0],j[1]+c,j[2]+m)) return False right = N *1000 left = -1 while right-left>1: mid = (right+left)//2 if clac(mid): right = mid else: left = mid if right == N*1000: print(-1) else: print(right)