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())) ans = 0 for pr1 in product((0, 1), repeat=N): for pr2 in product((0, 1), repeat=M): Wc = [] wi, vi = 0, 0 for i in range(N): if pr1[i]: Wc.append(A[i]) vi += B[i] for i in range(N): if pr2[i]: Wc.append(-C[i]) vi -= D[i] Wc.sort() l, r = 0, len(Wc) - 1 while l <= r: # print(l, r, Wc) if 0 <= Wc[l] + wi <= W: wi += Wc[l] l += 1 continue elif 0 <= Wc[r] + wi <= W: wi += Wc[r] r -= 1 continue else: break if l > r: ans = max(ans, vi) # print(pr1, pr2, l == r, ans, Wc) print(ans)