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())) adjacent_list = [[] for i in range(n+1)] for i in range(v): adjacent_list[s[i]].append([t[i],y[i],m[i]]) ans = 10**9 memo = [[10**9,10**9] for i in range(n+1)] def dfs(node,cost,time): if node == n: global ans ans = min(ans, time) if memo[node][0] < cost and memo[node][1] < time: return if memo[node][0] > cost and memo[node][1] > time: memo[node] = [cost, time] for n_node, n_cost, n_time in adjacent_list[node]: if n_cost + cost <= c: dfs(n_node,n_cost + cost, time + n_time) dfs(1,0,0) if ans == 10**9: print(-1) else: print(ans)