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 += [-c for c in C] B += [-d for d in D] n += m W_ = [-1] * (1 << n) V_ = [-1] * (1 << n) ok = [False] * (1 << n) ok[0] = True W_[0] = 0 V_[0] = 0 for bit in range(1 << n): for i in range(n): if bit >> i & 1: W_[bit] = W_[bit ^ (1 << i)] + A[i] V_[bit] = V_[bit ^ (1 << i)] + B[i] ok[bit] |= ok[bit ^ (1 << i)] if W_[bit] < 0 or W < W_[bit]: ok[bit] = False ans = max([v for o, v in zip(ok, V_) if o]) print(ans)