#dp[j][k] = 町jに所持金k円で行く最短時間 N = int(input()) C = int(input()) V = int(input()) lsS = list(map(int,input().split())) lsT = list(map(int,input().split())) lsY = list(map(int,input().split())) lsM = list(map(int,input().split())) lsedge = [] for i in range(V): lsedge.append((lsS[i],lsT[i],lsY[i],lsM[i])) lsedge.sort() dp = [[float('INF')]*(C+1) for i in range(N+1) ] dp[1][C] = 0 for i in range(1,V+1): from1 = lsedge[i-1][0] to = lsedge[i-1][1] cost = lsedge[i-1][2] time = lsedge[i-1][3] for k in range(C+1): if k - cost >= 0: dp[to][k-cost] = min(dp[to][k-cost],dp[from1][k]+time) if min(dp[N]) == float('INF'): print(-1) else: print(min(dp[N]))