import sys input = sys.stdin.readline 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())) G = [[] for i in range(N)] for s, t, y, m in zip(S, T, Y, M): G[s - 1].append((t - 1, y, m)) inf = 10 ** 18 dp = [[inf] * (C + 1) for _ in range(N)] dp[0][0] = 0 for i in range(N): for c in range(C): if dp[i][c] == inf: continue for u, y, m in G[i]: if c + y > C: continue dp[u][c + y] = min(dp[u][c + y], dp[i][c] + m) ans = min(dp[N - 1]) print(ans) if ans != inf else print(-1)