a,b,c,d,n=map(int,input().split()) p,q,r,s,t=map(int,input().split()) D=dict() for i in range(a+1): for j in range(b+1): if n