ll N,M,A,B,S,T; { mint V[2d5],R[2d5],X; rd(N,M); V[0]=R[0]=T=1; rep(N){ rd(A); RREP(i,S+=A)V[i+A]+=V[i]; } rep(M){ rd(B); RREP(i,T+=B)R[i+B]+=R[i]; } rd(A,B); V[1..S]+=V[0..]; rep(i,1,T)X+=R[i]*=V[min(B*i,S)]-V[min(A*i-1,S)]; wt(X); }