import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) { BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in)); try { int N = Integer.parseInt(stdReader.readLine()); int C = Integer.parseInt(stdReader.readLine()); int V = Integer.parseInt(stdReader.readLine()); String[] temp1 = stdReader.readLine().split(" "); String[] temp2 = stdReader.readLine().split(" "); String[] temp3 = stdReader.readLine().split(" "); String[] temp4 = stdReader.readLine().split(" "); int[] S = new int[V+1]; int[] T = new int[V+1]; int[] Y = new int[V+1]; int[] M = new int[V+1]; for(int i=1;i=0){ if(dp[T[j]][k-Y[j]] > dp[i][k]+M[j]){ dp[T[j]][k-Y[j]] = dp[i][k]+M[j]; } } } } } } int ans = Integer.MAX_VALUE; for(int i=0;i