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())) A = A + C B = B + D inf = 10 ** 18 N2 = 2 ** (N + M) dp = [[-inf] * (W + 1) for i in range(N2)] dp[0][0] = 0 for s in range(N2): for w in range(W + 1): for i in range(N + M): if (s >> i) & 1: continue if i < N: if w + A[i] > W: continue dp[s | (1 << i)][w + A[i]] = max(dp[s | (1 << i)][w + A[i]], dp[s][w] + B[i]) else: if w - A[i] < 0: continue dp[s | (1 << i)][w - A[i]] = max(dp[s | (1 << i)][w - A[i]], dp[s][w] - B[i]) ans = 0 for s in range(N2): for w in range(W + 1): ans = max(ans, dp[s][w]) print(ans)