n,m,w = map(int,input().split()) WV = [] for i in range(2): A = list(map(int,input().split())) B = list(map(int,input().split())) for a,b in zip(A,B): if i == 0: WV.append([a,b]) else: WV.append([-a,-b]) inf = 10**10 l = n+m dp = [-inf]*(1<> i & 1: size += WV[i][0] for i in range(l): if b >> i & 1: continue x,y = WV[i] if 0 <= size+x <= w: dp[b|1<