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 s in permutations(range(N)): for t in permutations(range(M)): i, j = 0, 0 w = 0 v = 0 # print(list(s), list(t)) while True: # print((w, v), (i, j)) if i < N and w+A[s[i]] <= W: w += A[s[i]] v += B[s[i]] ans = max(ans, v) i += 1 continue if j < M and w - C[t[j]] >= 0: w -= C[t[j]] v -= D[t[j]] ans = max(ans, v) j += 1 continue break # print((w, v), (i, j)) print(ans)