#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b>n>>m; vector v(n),r(m); rep(i,n) cin>>v[i]; rep(i,m) cin>>r[i]; ll A,B;cin>>A>>B; vector dv(200001,0),dr(200001,0); dv[0]=1;dr[0]=1; rep(i,n){ vector nxt(200001,0); for(int j=200000;j>=0;j--){ nxt[j]+=dv[j]; if(j-v[i]>=0) nxt[j]+=dv[j-v[i]]; nxt[j]%=mod; } swap(nxt,dv); } rep(i,m){ vector nxt(200001,0); for(int j=200000;j>=0;j--){ nxt[j]+=dr[j]; if(j-r[i]>=0) nxt[j]+=dr[j-r[i]]; nxt[j]%=mod; } swap(nxt,dr); } dv[0]=0;dr[0]=0; vector sum(200001,0); ll k=0; rep(i,200001){ k+=dv[i];k%=mod; sum[i]=k; } // rep(i,20) cout<