André and Bertrand are campaigning to become the new CPT president. After a long campaign André was able to quench victory, receiving votes to Bertrand's votes.
Reyno noticed that as the votes were tallied, an interesting pattern emerged. André received the first votes and at every point of the tally, he was at least votes ahead of Bertrand.
Reyno, always a fan of enumeration, wondered to himself: in how many ways could the tally have played out such that the above condition holds? Rather than solving it himself, he has enlisted your help. Don't let him down!
Input
Each test case contains three integers .
For of the cases, .
Output
For each test case, output the number of ways the voting could have played out, modulo .
Sample Input
2 1 0
Sample Output
2
Sample Input
6 5 0
Sample Output
132
Sample Input
11 8 1
Sample Output
11934
Explanation for Sample Input
In the first case, the two ways the vote could have went is ABA
and AAB
, where A
is a
vote for André and B
is a vote for Bertrand. BAA
is not a valid since after the first vote,
Bertrand has more votes than André.
Comments