Task
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 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 points while Little Triangle has points total.
Knowing (the number of problems that made up the math test), (the sum of the scores that Little Square got on the problems) and (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 .
Input data
The sole line of the input file subset.in
will contain tree nonnegative integers , and B, separated by a single space, with the same meaning as explained above.
Output data
The output file subset.out
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 .
Constraints
- 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 problems.
# | Points | Constraints |
---|---|---|
1 | 5 | |
2 | 7 | |
3 | 13 | |
4 | 15 | |
5 | 30 | |
6 | 30 | No additional constraints. |
Example 1
subset.in
2 3 2
subset.out
6
Explanation
In the first example, we have problems on the math test. Little Square has points in total, while Little Triangle has points in total. From now on let be the first problem, and the second problem.
There are distinct ways in which Little Square and Little Triangle could have scored on the test:
- Little Square: points - , points - ; Little Triangle: points - , points -
- Little Square: points - , points - ; Little Triangle: points - , points -
- Little Square: points - , points - ; Little Triangle: points - , points -
- Little Square: points - , points - ; Little Triangle: points - , points -
- Little Square: points - , points - ; Little Triangle: points - , points -
- Little Square: points - , points - ; Little Triangle: points - , points -
Example 2
subset.in
2 4 6
subset.out
0
Example 3
subset.in
36 43 27
subset.out
207434534
Example 4
subset.in
100001 999999 888888
subset.out
991579070