from heapq import heapify, heappop, heappush N = int(input()) C = int(input()) V = int(input()) *S, = map(int, input().split()) *T, = map(int, input().split()) *Y, = map(int, input().split()) *M, = map(int, input().split()) G = [[] for _ in [0]*(N+1)] for s, *t in zip(S, T, Y, M): G[s].append(t) INF = 10**10 D = [[INF]*(C+1) for _ in [0]*(N+1)] used = set() q = [] heappush(q, (0, 1, C)) while q: dmin = INF d, v, c = heappop(q) if (v, c) in used: continue used.add((v, c)) D[v][c] = d for u, y, m in G[v]: if (u, c-y) in used or c-y < 0: continue new_d = d+m if new_d < D[u][c-y]: heappush(q, (d+m, u, c-y)) ans = min(D[N]) if ans == INF: print(-1) else: print(ans)