# 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]].append((T[i], Y[i], M[i])) # vertex list. 0-indexed. has all (time, cost). l_vertex = [[] for __ in range(N)] l_vertex[0].append((0, 0)) for i in range(N): now_ver = l_vertex[i] for v in now_ver: for e in edge[i + 1]: next_ver = e[0] - 1 next_cost = v[1] + e[1] next_time = v[0] + e[2] if next_cost > C: continue else: l_vertex[next_ver].append((next_time, next_cost)) ans = 0 if len(l_vertex[N - 1]) == 0: ans = -1 else: l_ans = sorted(l_vertex[N - 1]) ans = l_ans[0][0] return ans def main(): params = read() print(solve(*params)) if __name__ == "__main__": main()