import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main_yukicoder1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int c = sc.nextInt(); int v = sc.nextInt(); int[] s = new int[v]; int[] t = new int[v]; int[] y = new int[v]; int[] m = new int[v]; for (int i = 0; i < v; i++) { s[i] = sc.nextInt(); } for (int i = 0; i < v; i++) { t[i] = sc.nextInt(); } for (int i = 0; i < v; i++) { y[i] = sc.nextInt(); } for (int i = 0; i < v; i++) { m[i] = sc.nextInt(); } List> edges = new ArrayList>(); for (int i = 0; i < n; i++) { edges.add(new ArrayList()); } for (int i = 0; i < v; i++) { edges.get(s[i] - 1).add(new Triple(t[i] - 1, y[i], m[i])); } final int INF = Integer.MAX_VALUE / 2; int[][] dp = new int[n][c + 1]; for (int i = 0; i < n; i++) { Arrays.fill(dp[i], INF); } dp[0][0] = 0; for (int i = 0; i < n; i++) { for (int j = 0; j <= c; j++) { for (Triple e : edges.get(i)) { if (j + e.b <= c) { dp[e.a][j + e.b] = Math.min(dp[e.a][j + e.b], dp[i][j] + e.c); } } } } int min = INF; for (int i = 0; i <= c; i++) { min = Math.min(min, dp[n - 1][i]); } if (min == INF) { System.out.println(-1); } else { System.out.println(min); } sc.close(); } private static class Triple { int a; int b; int c; Triple(int a, int b, int c) { this.a = a; this.b = b; this.c = c; } } }