Language: C++

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Majk
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <vector>


#include <unordered_map>
#include <map>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
using namespace std;

#define ll long long


template <unsigned int N> class Field {
    typedef unsigned int ui;
    typedef unsigned long long ull;
public:
	inline Field<N>&operator+=(const Field<N>&o) {if ((ll)v+o.v >= N) v = (ll)v+o.v-N; else v = v+o.v; return *this; }

	inline Field<N>&operator*=(const Field<N>&o) {v=(ull)v*o.v % N; return *this; }

	inline Field<N> operator*(const Field<N>&o) {Field<N>r(*this);return r*=o;};

private: ui v;
};

template<unsigned int N>ostream &operator<<(std::ostream&os,const Field<N>&f){return os<<(unsigned int)f;}

typedef Field<1000000007> FieldMod;


template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }



class J {
public:
	int N,A,B,C;
	vector<FieldMod> F,I;
	void solve(istream& cin, ostream& cout) {
		cin >> N >> A >> B >> C;

		if (B%2 == 1) {
			cout << 0 << endl;
			return;
		}

		F.resize(N); I.resize(N);
		F[0] = I[0] = 1;
		for (int i = 1; i <= N; ++i) {
			F[i] = F[i-1] * i;
			I[i] = I[i-1] / i;
		}



		FieldMod ans = 0;
		for (int p = max(0, A-C); p <= A; ++p) {
			int q = A - p;
			for (int r = 0; r <= (C - A + p) / 3; ++r) {
				int s = B / 2;
				int t = C - A + p - 3*r;

				FieldMod comb = F[p + q + r + s] * I[s] * I[p] * I[q] * I[r];
				if (t > 0 && s > 0) {
					ans += comb * F[t + s - 1] * I[t] * I[s - 1];
				} else if (t == 0) {
					ans += comb;
				}
			}
		}
		cout << ans << endl;

	}
};



int main() {
	ios_base::sync_with_stdio(false);
	J solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Compiler output:
a.cc: In member function 'void J::solve(std::istream&, std::ostream&)':
a.cc:64:31: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<Field<1000000007> >, Field<1000000007> >::value_type' {aka 'Field<1000000007>'} and 'int')
   64 |                 F[0] = I[0] = 1;
      |                               ^
a.cc:29:33: note: candidate: 'constexpr Field<1000000007>& Field<1000000007>::operator=(const Field<1000000007>&)'
   29 | template <unsigned int N> class Field {
      |                                 ^~~~~
a.cc:29:33: note:   no known conversion for argument 1 from 'int' to 'const Field<1000000007>&'
a.cc:29:33: note: candidate: 'constexpr Field<1000000007>& Field<1000000007>::operator=(Field<1000000007>&&)'
a.cc:29:33: note:   no known conversion for argument 1 from 'int' to 'Field<1000000007>&&'
a.cc:66:39: error: no match for 'operator*' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<Field<1000000007> >, Field<1000000007> >::value_type' {aka 'Field<1000000007>'} and 'int')
   66 |                         F[i] = F[i-1] * i;
a.cc:37:25: note: candidate: 'Field<N> Field<N>::operator*(const Field<N>&) [with unsigned int N = 1000000007]'
   37 |         inline Field<N> operator*(const Field<N>&o) {Field<N>r(*this);return r*=o;};
      |                         ^~~~~~~~
a.cc:37:50: note:   no known conversion for argument 1 from 'int' to 'const Field<1000000007>&'
   37 |         inline Field<N> operator*(const Field<N>&o) {Field<N>r(*this);return r*=o;};
      |                                   ~~~~~~~~~~~~~~~^
a.cc:67:39: error: no match for 'operator/' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<Field<1000000007> >, Field<1000000007> >::value_type' {aka 'Field<1000000007>'} and 'int')
   67 |                         I[i] = I[i-1] / i;
a.cc:72:32: error: conversion from 'int' to non-scalar type 'FieldMod' {aka 'Field<1000000007>'} requested
   72 |                 FieldMod ans = 0;
      |                                ^
a.cc: In instantiation of 'std::ostream& operator<<(std::ostream&, const Field<N>&) [with unsigned int N = 1000000007; std::ostream = std::basic_ostream<char>]':
a.cc:87:11:   required from here
   87 |                 cout << ans << endl;
      |                         ^~~
a.cc:42:90: error: invalid cast from type 'const Field<1000000007>' to type 'unsigned int'
   42 | template<unsigned int N>ostream &operator<<(std::ostream&os,const Field<N>&f){return os<<(unsigned int)f;}
      |                                                                                          ^~~~~~~~~~~~~~~