N = input() C = input() V = input() def func(x): return int(x) - 1 S = map(func,raw_input().split()) T = map(func,raw_input().split()) Y = map(int,raw_input().split()) M = map(int,raw_input().split()) LT = [[] for i in range(N)] LY = [[] for i in range(N)] LM = [[] for i in range(N)] for i in range(V): LT[S[i]].append(T[i]) LY[S[i]].append(Y[i]) LM[S[i]].append(M[i]) INF=99999999 DP = [[INF for i in range(C+1)] for j in range(N)] DP[0][0] = 0 for i in range(N): for j in range(C+1): if DP[i][j] != INF: for k in range(len(LT[i])): if j+LY[i][k] <=C: DP[LT[i][k]][j+LY[i][k]] = min(DP[LT[i][k]][j+LY[i][k]],DP[i][j]+LM[i][k]) min = INF flag = False for i in range(C+1): if(DP[N-1][i]