N,M=map(int,input().split()) V=list(map(int,input().split())) R=list(map(int,input().split())) A,B=map(int,input().split()) dp_V=[0]*(10**5+1) dp_V[0]=1 for v in V: for i in range(len(dp_V))[::-1]: if dp_V[i]!=0: dp_V[i+v]+=dp_V[i] dp_R=[0]*(10**5+1) dp_R[0]=1 for r in R: for i in range(len(dp_R))[::-1]: if dp_R[i]!=0: dp_R[i+r]+=dp_R[i] col_R=[0]*(10**5+1) col_R[0]=0 for i in range(1,len(dp_R)): col_R[i]=col_R[i-1]+dp_R[i] #print(dp_V) #print(col_R) ans=0 for i in range(1,len(dp_V)): low=-(-i//B) high=i//A ans+=(col_R[high]-col_R[low-1])*dp_V[i] print(ans)