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())) dp = [-1] * (W + 1) dp[0] = 0 for i in range(N): for w in range(W - A[i] + 1): if dp[w] != -1: dp[w + A[i]] = max(dp[w + A[i]], dp[w] + B[i]) for i in range(M): for w in range(W, C[i] - 1, -1): if dp[w] != -1: dp[w - C[i]] = max(dp[w - C[i]], dp[w] - D[i]) print(max(dp))