#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define fi first #define se second template inline bool chmax(A &a, B b) { if (a inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } typedef long long ll; typedef pair pii; typedef pair pll; typedef pair plp; const ll INF = 1e9+100; const ll MOD = 1e9+7; const double EPS = 1e-10; const bool debug = 0; //--------------------------------// ll mod_pow(ll x, ll n, ll mod) { if (n == 0) return 1; ll res = mod_pow(x * x % mod, n / 2, mod); if (n & 1) res = res * x % mod; return res; } vector fact, inv; void fact_inv(int n, ll mod) { fact.resize(n + 1); inv.resize(n + 1); fact[0] = 1; FOR(i, 1, n + 1) fact[i] = fact[i - 1] * i % mod; inv[n] = mod_pow(fact[n], mod - 2, mod); for (int i = n; i > 0; i--) inv[i - 1] = inv[i] * i % mod; } ll ncr(ll n, ll r, ll mod) { if (n < r || r < 0 || n < 0) return 0; return fact[n] * inv[r] % mod * inv[n - r] % mod; } int N, R, G, B; int main() { cin >> N >> R >> G >> B; int all = R + G + B; fact_inv(7000, MOD); ll ans = 0; REP(two, N) { int one = all - 2 * two; if (one < 0) break; int sc = N - one - 2 * two; // 空白マスの個数 int m = sc - (one + two - 1); // 自由な空白マスの個数 if (sc < 0 || m < 0) continue; ll pat = 0; REP(c, two + 1) { // R?の個数 if (c > R) break; int r = R - c, g = G - (two-c), b = B - (two-c); if (g < 0 || b < 0 || r > one) continue; ll now = fact[one+two] * inv[c]%MOD * inv[two-c]%MOD * inv[r]%MOD * inv[one-r]%MOD; now = now * ncr(g+b, g, MOD) % MOD; pat = (pat + now) % MOD; } pat = pat * mod_pow(2, two, MOD) % MOD * ncr(m + one + two, m, MOD) % MOD; ans = (ans + pat) % MOD; } cout << ans << endl; return 0; }