from itertools import product 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())) plus, minus = [], [] for pr in product((0, 1), repeat=N): wi, vi = 0, 0 for i in range(N): if pr[i]: wi += A[i] vi += B[i] plus.append((wi, vi)) for pr in product((0, 1), repeat=M): wi, vi = 0, 0 for i in range(M): if pr[i]: wi += C[i] vi += D[i] minus.append((wi, vi)) ans = 0 for pw, pv in plus: for mw, mv in minus: if 0 <= pw - mw <= W: ans = max(ans, pv - mv) print(ans)