""" """ 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())) for i in range(M): A.append(-C[i]) B.append(-D[i]) dpok = [False] * (2**(N+M)) dpok[0] = True w = [0] * (2**(N+M)) v = [0] * (2**(N+M)) for i in range(2**(N+M)): for j in range(N+M): if 2**j & i: w[i] += A[j] v[i] += B[j] #print (w,v) ans = 0 for i in range(2**(N+M)): if not dpok[i]: continue for j in range(N+M): if dpok[2**j | i] == False and 0 <= w[2**j | i] <= W: dpok[2**j | i] = True ans = max(ans , v[2**j | i]) print (ans)