N, M, W0 = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = [-i for i in list(map(int, input().split()))] D = [-i for i in list(map(int, input().split()))] NM = N + M W = [0] * (1 << NM) V = [0] * (1 << NM) checked = set() ans = 0 q = [] for i in range(N): x = 1 << i q.append(1 << i) W[x] = A[i] V[x] = B[i] A += C B += D while q: x = q.pop(-1) v = V[x] w = W[x] for i in range(NM): if x >> i & 1: continue y = x | (1 << i) if y in checked: continue if W0 < w + A[i]: checked.add(y) if 0 <= w + A[i] <= W0: y = x | (1 << i) W[y] = w + A[i] V[y] = v + B[i] q.append(y) checked.add(y) print(max(V))