#abc260h. [abc260_h]Colorfulness
[abc260_h]Colorfulness
Problem Statement
There are balls numbered through . Ball is painted in Color .
For a permutation of , let us define as follows:
- The number of pairs of adjacent balls with different colors when Balls are lined up in a row in this order.
Let be the set of all permutations of . Also, let us define by:
$\\displaystyle F(k) = \\left(\\sum_{P \\in S_N}C(P)^k \\right) \\bmod 998244353$.
Enumerate .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answers in the following format:
Sample Input 1
3 4
1 1 2
Sample Output 1
8 12 20 36
Here is the list of all possible pairs of .
- If , then .
- If , then .
- If , then .
- If , then .
- If , then .
- If , then .
We may obtain the answers by assigning these values into . For instance, .
Sample Input 2
2 1
1 1
Sample Output 2
0
Sample Input 3
10 5
3 1 4 1 5 9 2 6 5 3
Sample Output 3
30481920 257886720 199419134 838462446 196874334