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 s=set() for i in range(20): s.add(1<>i)&1==0: continue if bit in s: if i<=N-1: w[i][bit]=A[i] dp[i][bit]=B[i] continue for j in range(N+M): if i==j or (bit>>j)&1==0: continue if i<=N-1 and dp[j][bit^(1<=N and dp[j][bit^(1<