#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair pint; typedef pair pli; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; ll dp[3030][3030]; template struct SegmentTree{ private: int n; T E; vector node; inline void updatef(T& x,T& y){ //x = y; (x += y)%=mod; //x = max(x,y); //x = min(x,y); } inline T queryf(T& x,T& y){ //return x*y; return (x+y)%mod; //return max(x,y); //return min(x,y); } public: SegmentTree(int sz,T E_=0):E(E_){ n=1; while(n& A,T& E_):E(E_){ int sz=A.size(); n=1; while(n=0;--i){ node[i]=queryf(node[2*i+1], node[2*i+2]); } } void update(int k,T x){ k+=n-1; updatef(node[k],x); while(k>0){ k=(k-1)/2; node[k]=queryf(node[2*k+1], node[2*k+2]); } } //[a,b)での和を返す T get(int a,int b,int k=0,int l=0,int r=-1){ if(r<0)r=n; if(r<=a||b<=l)return E; if(a<=l&&r<=b)return node[k]; T xl=get(a,b,2*k+1,l,(l+r)/2); T xr=get(a,b,2*k+2,(l+r)/2,r); return queryf(xl, xr); } }; int main(){ int n,m,d1,d2; cin>>n>>m>>d1>>d2; assert(n<=3000); vector> sg(n+2,m+5); sg[0].update(0,1); rep(i,n){ rep(j,m){ if(i==0){ ll ret=sg[0].get(0,j+1); sg[1].update(j+1,ret); } else { ll ret=sg[i].get(max(0,j+1-d2),max(0,j+2-d1)); sg[i+1].update(j+1,ret); } } } cout<