# coding: utf-8 import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time sys.setrecursionlimit(10 ** 7) INF = 10 ** 20 MOD = 10 ** 9 + 7 def II(): return int(input()) def ILI(): return list(map(int, input().split())) def IAI(LINE): return [ILI() for __ in range(LINE)] def IDI(): return {key: value for key, value in ILI()} def read(): N = II() C = II() V = II() S = ILI() T = ILI() Y = ILI() M = ILI() return (N, C, V, S, T, Y, M) def solve(N, C, V, S, T, Y, M): edge = collections.defaultdict(list) for i in range(V): edge[S[i] - 1].append((T[i] - 1, Y[i], M[i])) dp = [[INF] * (C + 1) for _ in range(N)] dp[0][C] = 0 queue = list() heapq.heappush(queue, (0, C)) while len(queue) > 0: now_ver, now_cost = heapq.heappop(queue) now_time = dp[now_ver][now_cost] for next_ver, next_cost, next_time in edge[now_ver]: if (now_cost - next_cost) < 0: continue else: if dp[next_ver][now_cost - next_cost] > (now_time + next_time): dp[next_ver][now_cost - next_cost] = now_time + next_time heapq.heappush(queue, (next_ver, now_cost - next_cost)) ans = INF for m in dp[N - 1]: ans = min(ans, m) if ans == INF: ans = -1 return ans def main(): params = read() print(solve(*params)) if __name__ == "__main__": main()