from itertools import permutations N,M,W = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) D = list(map(int,input().split())) ans = 0 for u in range(1<>ku) & 1: Box1.append((A[ku],B[ku])) Box1 = sorted(Box1,key=lambda x:-x[0]) for v in range(1<>kv) & 1: Box2.append((C[kv],D[kv])) for z in permutations(range(len(Box2))): w = 0 j = 0 vx = 0 for i in range(len(Box1)): if w+Box1[i][0]<=W: w += Box1[i][0] vx += Box1[i][1] while j=Box2[z[j]][0]: w -= Box2[z[j]][0] vx -= Box2[z[j]][1] j += 1 ans = max(ans,vx) print(ans)