N, M, W = list(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 import itertools for n in itertools.permutations(range(N), N): for m in itertools.permutations(range(M), M): w = 0 v = 0 ni = 0 mi = 0 while True: while ni < N: if w + A[n[ni]] > W: break w += A[n[ni]] v += B[n[ni]] ni += 1 ans = max(ans, v) if mi == M: break if w - C[m[mi]] < 0: break w -= C[m[mi]] v -= D[m[mi]] ni += 1 if ni == N: break print(ans)