#include #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<(int)(n);++i) #define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i) #define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i) #define each(a,b) for(auto (a): (b)) #define all(v) (v).begin(),(v).end() #define len(v) (int)(v).size() #define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end()) #define cmx(x,y) x=max(x,y) #define cmn(x,y) x=min(x,y) #define fi first #define se second #define pb push_back #define show(x) cout<<#x<<" = "<<(x)< P; typedef vector vi; typedef vector vvi; typedef vector vl; typedef vector vd; typedef vector

vp; const int MAX_N = 3005; ll dp[MAX_N]; ll inv[MAX_N],fac[MAX_N],finv[MAX_N]; void make() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for(int i=2;i>= 1; } return res; } ll add(ll x,ll y) { return (x + y)%MOD; } ll sub(ll x,ll y) { return (x+MOD-y)%MOD; } ll mul(ll x,ll y) { return x*y%MOD; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n,r,g,b; cin >> n >> r >> g >> b; int a = r + g + b; ll ans = 0; make(); srep(i,(a+1)/2,a+1){ if(i-1 > n-a){ break; } int rem = (n-a)-(i-1); int one = 2*i-a, two = a-i; ll hoge = mul(fac[i],mul(comb(rem+i,i),mod_pow(2,two))); rep(j,min(min(r,g),two)+1){ rep(k,min(min(g-j,b),two-j)+1){ int l = two-j-k; if(l > min(r-j,b-k)){ continue; } ll tm = hoge; tm = mul(mul(tm,finv[r-j-l]),mul(finv[g-j-k],finv[b-k-l])); tm = mul(mul(tm,finv[j]),mul(finv[k],finv[l])); ans = add(ans,tm); } } } cout << ans << "\n"; return 0; }