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())) ans = 0 for i in range(1<>k)&1: w += A[k] v += B[k] for j in range(1<>l)&1: w0 -= C[l] v0 -= D[l] if w0<=W: ans = max(ans,v0) print(ans)