#include #include #include using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 struct combi{ deque kaijou; deque kaijou_; combi(int n){ kaijou.push_back(1); for(int i=1;i<=n;i++){ kaijou.push_back(kaijou[i-1]*i); } mint b=kaijou[n].inv(); kaijou_.push_front(b); for(int i=1;i<=n;i++){ int k=n+1-i; kaijou_.push_front(kaijou_[0]*k); } } mint combination(int n,int r){ if(r>n)return 0; mint a = kaijou[n]*kaijou_[r]; a *= kaijou_[n-r]; return a; } mint junretsu(int a,int b){ mint x = kaijou_[a]*kaijou_[b]; x *= kaijou[a+b]; return x; } mint catalan(int n){ return combination(2*n,n)/(n+1); } }; int main(){ int A,B,X,Y; cin>>A>>B>>X>>Y; vector d(4,0); rep(i,B){ d[i%4]++; } combi C(3000000); d[B%4]++; mint ans = 0; rep(i,A+1){ vector c(4,0); c[0] = i; c[2] = i - X; if(c[2]<0)continue; int remain = A - c[0] - c[2]; remain -= abs(Y); if(remain<0)continue; if(remain%2==1)continue; if(Y>=0){ c[1] = Y + remain/2; c[3] = remain/2; } else{ c[3] = abs(Y) + remain/2; c[1] = remain/2; } mint temp = 1; rep(j,4){ if(c[j]==0&&d[j]==0)continue; if(d[j]==0 && c[j]>0){ temp = 0; } else{ //cout<