#abc226f. [abc226_f]Score of Permutations
[abc226_f]Score of Permutations
Problem Statement
For a permutation of , let us define the score of as follows.
- There are people, numbered . Additionally, Snuke is there. Initially, Person has Ball .
Each time Snuke screams, every Person such that gives their ball to Person simultaneously.
If, after screaming at least once, every Person has Ball , Snuke stops screaming.
The score is the number of times Snuke screams until he stops. Here, it is guaranteed that the score will be a finite value.
There are permutations of . Find the sum, modulo , of the scores of those permutations, each raised to the -th power.
- Formally, let be the set of the permutations of . Compute the following: $\\displaystyle \\left(\\sum_{P \\in S_N} S(P)^K \\right) \\bmod {998244353}$.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print $\\displaystyle \\left(\\sum_{P \\in S_N} S(P)^K \\right) \\bmod {998244353}$.
Sample Input 1
2 2
Sample Output 1
5
When , there are two possible permutations : .
The score of the permutation is found as follows.
- Initially, Person has Ball , and Person has Ball .
After Snuke's first scream, Person has Ball , and Person has Ball .
Here, every Person has Ball , so he stops screaming.
Thus, the score is .
The score of the permutation is found as follows.
- Initially, Person has Ball , and Person has Ball .
After Snuke's first scream, Person has Ball , and Person has Ball .
After Snuke's second scream, Person has Ball , and Person has Ball .
Here, every Person has Ball , so he stops screaming.
Thus, the score is .
Therefore, the answer in this case is .
Sample Input 2
3 3
Sample Output 2
79
All permutations and their scores are listed below.
- : The score is .
- : The score is .
- : The score is .
- : The score is .
- : The score is .
- : The score is .
Thus, we should print .
Sample Input 3
50 10000
Sample Output 3
77436607