#agc060c. [agc060_c]Large Heap
[agc060_c]Large Heap
Problem Statement
Consider a permutation of . is said to be heaplike if and only if all of the following conditions are satisfied.
- ()
- ()
You are given integers and . Let and .
Find the probability, modulo , that for a heaplike permutation chosen uniformly at random.
Definition of probability modulo
It can be proved that the sought probability is always rational. Additionally, under the constraints of this problem, when the sought rational number is represented as an irreducible fraction , it can be proved that . Therefore, there is a unique integer such that and . Print this .
Constraints
- All numbers in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
2 1 1
Sample Output 1
499122177
There are two heaplike permutations: . The probability that is .
Sample Input 2
3 1 2
Sample Output 2
124780545
Sample Input 3
4 3 2
Sample Output 3
260479386
Sample Input 4
2022 12 25
Sample Output 4
741532295