시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB195440.000%

문제

Little Square and Little Triangle took a math test. Little Triangle didn’t study for the test, but, fortunately for him, Little Square, his best friend, succeeded in studying for the exam, so Little Triangle was able to copy parts of Little Square’s solutions on the test.

We know that the test had $N$ problems in total and that at each one of them Little Triangle’s score is not more than Little Square’s score. All scores are nonegative integers. We don’t know the exact score of any of them at any problem, but we know that in total Little Square has $A$ points while Little Triangle has $B$ points total.

Knowing $N$ (the number of problems that made up the math test), $A$ (the sum of the scores that Little Square got on the problems) and $B$ (Little Triangle’s sum of scores), we want to compute the number of ways in which the two of them could have been scored on the test, modulo $10^9 + 7$.

입력

The sole line of standard input will contain tree nonnegative integers $N$, $A$ and $B$, separated by a single space, with the same meaning as explained above.

출력

The standard output will contain only one integer, representing the number of ways in which Little Square and Little Triangle could have been scored on the test, modulo $10^9 + 7$.

제한

  • $1 ≤ N ≤ 10^6$
  • $0 ≤ A, B ≤ 10^6$
  • $2$ ways of scoring are considered distinct (different) if Little Square or Little Triangle have a different number of points on at least one of the $N$ problems.

서브태스크 1 (5점)

  • $N ≤ 2$
  • $0 ≤ A, B ≤ 10^3$

서브태스크 2 (7점)

  • $N ≤ 2$
  • $0 ≤ A, B ≤ 10^6$

서브태스크 3 (13점)

  • $1 ≤ N ≤ 5$
  • $ 0 ≤ A, B ≤ 5$

서브태스크 4 (15점)

  • $1 ≤ N ≤ 10^6$
  • $B = 0$
  • $0 ≤ A ≤ 10^6$

서브태스크 5 (30점)

  • $1 ≤ N ≤ 50$
  • $0 ≤ A, B ≤ 50$

서브태스크 6 (30점)

No additional constraints.

예제 입력 1

2 3 2

예제 출력 1

6

예제 입력 2

2 4 6

예제 출력 2

0

예제 입력 3

36 43 27

예제 출력 3

207434534

예제 입력 4

100001 999999 888888

예제 출력 4

991579070

힌트

In the first example, we have $N = 2$ problems on the math test. Little Square has $A = 3$ points in total, while Little Triangle has $B = 2$ points in total. From now on let $P1$ be the first problem, and $P2$ the second problem.

There are $6$ distinct ways in which Little Square and Little Triangle could have scored on the test:

  • Little Square: $0$ points - $P1$, $3$ points - $P2$; Little Triangle: $0$ points - $P1$, $2$ points - $P2$
  • Little Square: $1$ points - $P1$, $2$ points - $P2$; Little Triangle: $0$ points - $P1$, $2$ points - $P2$
  • Little Square: $1$ points - $P1$, $2$ points - $P2$; Little Triangle: $1$ points - $P1$, $1$ points - $P2$
  • Little Square: $2$ points - $P1$, $1$ points - $P2$; Little Triangle: $2$ points - $P1$, $0$ points - $P2$
  • Little Square: $2$ points - $P1$, $1$ points - $P2$; Little Triangle: $1$ points - $P1$, $1$ points - $P2$
  • Little Square: $3$ points - $P1$, $0$ points - $P2$; Little Triangle: $2$ points - $P1$, $0$ points - $P2$

채점 및 기타 정보

  • 예제는 채점하지 않는다.