import sys #sys.setrecursionlimit(n) import heapq import re import bisect from collections import defaultdict, deque n = int(input()) c = int(input()) v = int(input()) s = tuple(map(int, input().split())) t = tuple(map(int, input().split())) y = tuple(map(int, input().split())) m = tuple(map(int, input().split())) d = defaultdict(lambda : defaultdict(list)) for i in range(v): d[s[i]][t[i]].append((m[i] << 16) + y[i]) def solve(): heap = [] heapq.heappush(heap, (0 << 32) + (0 << 16) + 1) while (heap): h = heapq.heappop(heap) hm = (h >> 32) & 0xFFFFFFFF hcost = (h >> 16) & 0xFFFF hpos = h & 0xFFFF if hpos == n: return hm else: for dd in d[hpos]: for td in d[hpos][dd]: nextcost = (td & 0xFFFF) + hcost nexthm = ((td >> 16) & 0xFFFFFFFF) + hm if nextcost <= c: heapq.heappush(heap, (nexthm << 32) + (nextcost << 16) + dd) return -1 print(solve())