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=[[-1]*(1<<(N+M)) for _ in range(N+M)] w=[[-1]*(1<<(N+M)) for _ in range(N+M)] for i in range(N+M): dp[i][0]=0 w[i][0]=0 ans=0 for bit in range(1,1<<(N+M)): for i in range(N+M): if (bit>>i)&1==0: continue for j in range(N+M): if i<=N-1 and w[j][bit^(1<=N and w[j][bit^(1<=0: dp[i][bit]=max(dp[i][bit],dp[j][bit^(1<