import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd 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 = [[0]*(510) for i in range(1<<(n+m))] ans = 0 for bit in range(1<<(n+m)): for i in range(n+m): if not((bit>>i)&1): continue for w in range(510): if i < n and w >= a[i]: dp[bit][w] = max(dp[bit][w],dp[bit-(1<= n and w + c[i-n] <= W: dp[bit][w] = max(dp[bit][w],dp[bit-(1<