#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair const int inf=1e9+7; const ll mod=1e9+7; ll VDP[105][100005]; ll RDP[105][100005]; int main() { int N, M; cin>>N>>M; vector V(N), R(M); for(int i=0;i>V[i]; } for(int i=0;i>R[i]; } int A, B; cin>>A>>B; VDP[0][V[0]] = 1; RDP[0][R[0]] = 1; for(int i=1;i100000) break; if(i*B>100000){ ans += ((VDP[N-1][100002] - VDP[N-1][i*A-1]) * RDP[M-1][i]) % mod; ans %= mod; } else{ ans += ((VDP[N-1][i*B] - VDP[N-1][i*A-1]) * RDP[M-1][i]) % mod; ans %= mod; } } cout<