#abc243f. [abc243_f]Lottery
[abc243_f]Lottery
Problem Statement
Takahashi is participating in a lottery.
Each time he takes a draw, he gets one of the prizes available. Prize is awarded with probability . The results of the draws are independent of each other.
What is the probability that he gets exactly different prizes from draws? Find it modulo .
Note
To print a rational number, start by representing it as a fraction . Here, and should be integers, and should not be divisible by (under the Constraints of this problem, such a representation is always possible). Then, print the only integer between and (inclusive) such that .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
2 1 2
2
1
Sample Output 1
221832079
Each draw awards Prize with probability and Prize with probability .
He gets Prize at both of the two draws with probability , and Prize at both draws with probability , so the sought probability is .
The modulo representation of this value, according to Note, is .
Sample Input 2
3 3 2
1
1
1
Sample Output 2
0
It is impossible to get three different prizes from two draws, so the sought probability is .
Sample Input 3
3 3 10
499122176
499122175
1
Sample Output 3
335346748
Sample Input 4
10 8 15
1
1
1
1
1
1
1
1
1
1
Sample Output 4
755239064