N=int(input()) C=int(input()) V=int(input()) S=list(map(int,input().split())) T=list(map(int,input().split())) Cost=list(map(int,input().split())) Time=list(map(int,input().split())) L=[[]for i in range(N+1)] for i in range(V): L[S[i]].append([Time[i],Cost[i],T[i]]) DP=[[10**9 for i in range(C+1)]for j in range(N+1)] DP[1][0]=0 #print(DP) import heapq Q=[] for time,cost,t in L[1]: if cost<=C: Q.append((time,cost,t)) heapq.heapify(Q) for i in range(10**7): if len(Q)==0: break time,cost,t=heapq.heappop(Q) if DP[t][cost]==10**9: DP[t][cost]=time for fortime,forcost,fort in L[t]: if cost+forcost<=C and DP[t][cost+forcost]==10**9: heapq.heappush(Q,(time+fortime,cost+forcost,fort)) if min(DP[-1])==10**9: print(-1) else: print(min(DP[-1]))