#include #include #include #include #include #include #include using namespace std; const int mod = 1000000007; int N, R, G, B, comb[3009][3009]; int main() { comb[0][0] = 1; for (int i = 1; i <= 3000; i++) { for (int j = 0; j <= i; j++) { comb[i][j] = comb[i - 1][j]; if (j >= 1) comb[i][j] += comb[i - 1][j - 1]; if (comb[i][j] >= mod) comb[i][j] -= mod; } } cin >> N >> R >> G >> B; if (R > G) swap(R, G); if (R > B) swap(R, B); if (G > B) swap(G, B); int ret = 0, pw = 1; for (int two = 0; 2 * two <= R + G + B; two++) { int one = R + G + B - 2 * two; if (3 * two + 2 * one >= N + 2) { pw = 2 * pw % mod; continue; } int res = 0; for (int i = 0; i <= R; i++) { for (int j = 0; j <= G; j++) { int k = 2 * two - i - j; if (0 <= k && k <= B && two - i >= 0 && two - j >= 0 && two - k >= 0) { int a = two - i, b = two - j, c = two - k; res = (res + 1LL * comb[two][a] * comb[two - a][b] % mod * comb[one][R - i] % mod * comb[one - R + i][G - j]) % mod; } } } ret = (ret + 1LL * res * comb[N + 1 - two * 2 - one][two] % mod * comb[N + 1 - two * 3 - one][one] % mod * pw) % mod; pw = 2 * pw % mod; } cout << ret << endl; return 0; }