#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 def main(): n = I() x = I() I() s = LI() t = LI() y = LI() m = LI() v = [[] for _ in range(n)] for a,b,c,d in zip(s,t,y,m): a -= 1 b -= 1 v[a].append((b,c,d)) d = defaultdict(lambda : float("inf")) d[(0,x)] = 0 q = [(0,0,x)] ans = float("inf") while q: dx,x,c = heappop(q) if dx > d[(x,c)]: continue if x == n-1 and dx < ans: ans = dx for y,cost,w in v[x]: nd = dx+w nc = c-cost if nc >= 0 and nd < d[(y,nc)]: d[(y,nc)] = nd heappush(q,(nd,y,nc)) if ans == float("inf"): ans = -1 print(ans) return if __name__ == "__main__": main()