import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; 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=1;j--){ if(money[i-j][i]!=0){ if((i-j) != 1){ if(moneyDP[i-j]!=0 && (moneyDP[i] == 0 || moneyDP[i]>moneyDP[i-j]+money[i-j][i])){ if(costDP[i-j]+cost[i-j][i]<=C){ moneyDP[i] = moneyDP[i-j]+money[i-j][i]; costDP[i] = costDP[i-j]+cost[i-j][i]; } } }else{ if(costDP[i-j]+cost[i-j][i]<=C){ moneyDP[i] = moneyDP[i-j]+money[i-j][i]; costDP[i] = costDP[i-j]+cost[i-j][i]; } } } } } System.out.println(moneyDP[N]!=0?moneyDP[N]:-1); } catch (IOException e) { e.printStackTrace(); } } }