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 perm1 in permutations(range(N)): for perm2 in permutations(range(M)): idx1 = 0 idx2 = 0 w = 0 v = 0 while idx1 < N: if w+A[perm1[idx1]] <= W: w += A[perm1[idx1]] v += B[perm1[idx1]] ans = max(ans, v) idx1 += 1 else: while idx2 < M and W < w+A[perm1[idx1]]: w -= C[perm2[idx2]] v -= D[perm2[idx2]] idx2 += 1 if W < w+A[perm1[idx1]] or w < 0: break print(ans)