
Oliver is a rubber duck that not only finds bugs, but also likes to paint.
His latest painting has
- Oliver will select uniformly at random an index
, and memorize the colour on the part of the painting. - Again, Oliver will select uniformly at random an index
. He will repaint the part of the painting with the colour of the part of the painting. If the part is already painted in that colour, there is no change. Note that can be equal to .
Now, Oliver is afraid his painting will become monotonous or boring.
He considers a painting good if there are at least
Input Specification
The first line contains the integers from the task statement,
Output Specification
On the first and only line, output the answer modulo
Formally, let
Constraints
Subtask | Points | Constraints |
---|---|---|
1 | 30 | |
2 | 40 | |
3 | 40 | No additional constraints. |
Sample Input 1
2 1 2
Sample Output 1
500000004
Explanation for Sample 1
There are two colours on the painting, so the probability that it remains the same after one iteration is
Sample Input 2
10 2 5
Sample Output 2
1
Explanation for Sample 2
After two iterations, the number of different colours can't go from
Sample Input 3
3 141592653589793 2
Sample Output 3
468261332
Comments