#agc036c. [agc036_c]GP 2
[agc036_c]GP 2
Problem Statement
We have a sequence of integers: . Initially, for each ().
Snuke will perform the following operation exactly times:
- Choose two distinct indices (). Then, replace with and with .
Find the number of different sequences that can result after operations. Since it can be enormous, compute the count modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of different sequences that can result after operations, modulo .
Sample Input 1
2 2
Sample Output 1
3
After two operations, there are three possible outcomes:
For example, can result after the following sequence of operations:
- First, choose , changing from to .
- Second, choose , changing from to .
Sample Input 2
3 2
Sample Output 2
19
Sample Input 3
10 10
Sample Output 3
211428932
Sample Input 4
100000 50000
Sample Output 4
3463133