import itertools 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())) ITER=[i for i in range(n+1)] ans=0 for bit in itertools.product([1,0], repeat=n): for M in itertools.product(ITER, repeat=m): tmpA=A[:] tmpB=B[:] flag=1 for j in range(m): if M[j]==n:continue tmpA[M[j]]-=C[M[j]] tmpB[M[j]]-=D[M[j]] if tmpA[M[j]]<0:flag=0 if tmpB[M[j]]<0:flag=0 if flag: tmp=[0,0] for i in range(n): if bit[i]: tmp[0]+=tmpA[i] tmp[1]+=tmpB[i] if tmp[0]<=w: ans=max(ans,tmp[1]) print(ans)