import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 import time t1 = time.time() n, m, w = mi() a = li() b = li() c = [-v for v in li()] d = [-v for v in li()] ans = 0 import itertools for bit1 in range(1 << n): for bit2 in range(1 << m): WV = [(0, 0)] for i in range(n): if 1 & (bit1 >> i): WV.append((a[i], b[i])) WIS = [(0, 0)] for i in range(m): if 1 & (bit2 >> i): WIS.append((c[i], d[i])) for WIS in itertools.permutations(WIS): j = 0 noww = 0 nowv = 0 for x, y in WV: noww += x nowv += y if noww > w: nowv = -inf break if j < len(WIS) and WIS[j][0] <= noww: noww += WIS[j][0] nowv += WIS[j][1] j += 1 ans = max(ans, nowv) print(ans)