#abc205e. [abc205_e]White and Black Balls
[abc205_e]White and Black Balls
Problem Statement
How many ways are there to arrange white balls and black balls in a row from left to right to satisfy the following condition?
- For each , let and be the number of white balls and black balls among the leftmost balls, respectively. Then, holds for every .
Since the count can be enormous, find it modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer. Be sure to find the count modulo .
Sample Input 1
2 3 1
Sample Output 1
9
There are ways to arrange white balls and black balls in a row, as shown below, where w
and b
stand for a white ball and a black ball, respectively.
wwbbb
wbwbb
wbbwb
wbbbw
bwwbb
bwbwb
bwbbw
bbwwb
bbwbw
bbbww
Among them, wwbbb
is the only one that does not satisfy the condition. Here, there are white balls and black balls among the leftmost balls, and we have .
Sample Input 2
1 0 0
Sample Output 2
0
There may be no way to satisfy the condition.
Sample Input 3
1000000 1000000 1000000
Sample Output 3
192151600
Be sure to print the count modulo .