#int(input()) #map(int, input().split()) #list(map(int, input().split())) 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())) import heapq vs = [0] * (1 << (N+M)) ws = [0] * (1 << (N+M)) for i in range(1 << (N+M)): v = 0 w = 0 for j in range(N+M): if i & (1 << j): if j < N: w += A[j] v += B[j] else: w -= C[j-N] v -= D[j-N] vs[i] = v ws[i] = w d = [0] * (1 << (N+M)) d[0] = 1 q = [0] ans = 0 while q: t = q.pop() for i in range(N+M): if not t & (1 << i): x = t + (1 << i) if d[x] == 0 and ws[x] <= W and ws[x] >= 0: q.append(x) d[x] = 1 ans = max(ans, vs[x]) print(ans)