from heapq import heappush, heappop import sys input = sys.stdin.readline N = int(input()) C = int(input()) V = int(input()) S = list(map(lambda x: int(x) - 1, input().split())) T = list(map(lambda x: int(x) - 1, input().split())) Y = list(map(int, input().split())) M = list(map(int, input().split())) G = [[] for _ in range(N)] for s, t, y, m in zip(S, T, Y, M): G[s].append((t, y, m)) INF = 10**18 dist = [[INF] * (C + 1) for _ in range(N)] dist[0][0] = 0 pq = [(0, 0, 0)] while pq: d, s, c = heappop(pq) if dist[s][c] < d: continue for t, y, m in G[s]: if c + y > C: continue nd = d + m nc = c + y if nd < dist[t][nc]: dist[t][nc] = nd heappush(pq, (nd, t, nc)) ans = min(dist[-1]) print(ans if ans < INF else -1)