N,M,W=map(int,input().split()) A=list(map(int,input().split())) A.sort(reverse=True) B=[0]+list(map(int,input().split())) C=[0]+list(map(int,input().split())) D=[] for b,c in zip(B,C): D.append([b,c]) D.sort() j=0 for i in range(M+1): w=0;v=0 while jD[i][1]: D[i][1]=v for k in range(D[i][0]): A[j-1-k]=0 A.sort(reverse=True) dp=[set() for _ in range(21)] dp[0].add((0,0)) for i in range(M): for w,v in list(dp[i]): dp[i+1].add((w,v)) if w+D[i+1][0]<=W:dp[i+1].add((w+D[i+1][0],v+D[i+1][1])) ans_w=0 ans_v=0 for w,v in list(dp[M]): if v>ans_v or (v==ans_v and w