n,m,k = 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())) ac = a+[-w for w in c] bd = b+[-v for v in d] f = [False]*(1<>j&1: s += ac[j] for j in range(n+m): if i>>j&1: continue if 0<=s+ac[j]<=k: f[i|1<