import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int c = sc.nextInt(); int v = sc.nextInt(); ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { graph.add(new ArrayList<>()); } int[] ss = new int[v]; for (int i = 0; i < v; i++) { ss[i] = sc.nextInt() - 1; } int[] ts = new int[v]; for (int i = 0; i < v; i++) { ts[i] = sc.nextInt() - 1; } int[] ys = new int[v]; for (int i = 0; i < v; i++) { ys[i] = sc.nextInt(); } for (int i = 0; i < v; i++) { graph.get(ss[i]).add(new Route(ts[i], ys[i], sc.nextInt())); } PriorityQueue queue = new PriorityQueue<>(); queue.add(new Route(0, 0, 0)); int[][] costs = new int[n][c + 1]; for (int[] arr : costs) { Arrays.fill(arr, Integer.MAX_VALUE); } while (queue.size() > 0) { Route r = queue.poll(); if (r.yen > c || costs[r.idx][r.yen] <= r.time) { continue; } costs[r.idx][r.yen] = r.time; for (Route x : graph.get(r.idx)) { queue.add(new Route(x.idx, r.yen + x.yen, r.time + x.time)); } } int ans = Integer.MAX_VALUE; for (int x : costs[n - 1]) { ans = Math.min(ans, x); } if (ans == Integer.MAX_VALUE) { System.out.println(-1); } else { System.out.println(ans); } } static class Route implements Comparable { int idx; int yen; int time; public Route(int idx, int yen, int time) { this.idx = idx; this.yen = yen; this.time = time; } public int compareTo(Route r) { return time - r.time; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }