atcoder#CF16EXHIBITIONFINALJ. 123 Pairs

123 Pairs

Score : 15001500 points

Problem Statement

Consider all integers between 11 and 2N2N, inclusive. Snuke wants to divide these integers into NN pairs such that:

  • Each integer between 11 and 2N2N is contained in exactly one of the pairs.
  • In exactly AA pairs, the difference between the two integers is 11.
  • In exactly BB pairs, the difference between the two integers is 22.
  • In exactly CC pairs, the difference between the two integers is 33.

Note that the constraints guarantee that N=A+B+CN = A + B + C, thus no pair can have the difference of 44 or more.

Compute the number of ways to do this, modulo 109+710^9+7.

Constraints

  • 1N50001 \leq N \leq 5000
  • 0A,B,C0 \leq A, B, C
  • A+B+C=NA + B + C = N

Input

The input is given from Standard Input in the following format:

NN AA BB CC

Output

Print the answer.

3 1 2 0
2

There are two possibilities: 12,35,461-2, 3-5, 4-6 or 13,24,561-3, 2-4, 5-6.

600 100 200 300
522158867