#arc145f. [arc145_f]Modulo Sum of Increasing Sequences

[arc145_f]Modulo Sum of Increasing Sequences

Problem Statement

Find the number, modulo 998244353998244353, of non-decreasing sequences A=(A1,A2,ldots,AN)A=(A_1,A_2,\\ldots,A_N) of length NN consisting of integers between 00 and MM (inclusive) that satisfy the following, for each K=0,1,ldots,mathrmMOD1K=0,1,\\ldots,\\mathrm{MOD}-1:

  • the sum of the elements in AA is congruent to KK modulo mathrmMOD\\mathrm{MOD}.

What is a non-decreasing sequence? A sequence BB is non-decreasing if and only if BileqBi+1B_i \\leq B_{i+1} for every integer (1leileB11 \\le i \\le |B| - 1), where B|B| is the length of BB.

Constraints

  • 1leqN,Mleq1061 \\leq N ,M\\leq 10^6
  • 1leqmathrmMODleq5001\\leq \\mathrm{MOD}\\leq 500
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM mathrmMOD\\mathrm{MOD}

Output

For each K=0,1,ldots,mathrmMOD1K=0,1,\\ldots,\\mathrm{MOD}-1, print the number, modulo 998244353998244353, of sequences that satisfy the condition.


Sample Input 1

2 2 4

Sample Output 1

2 1 2 1

There are 66 non-decreasing sequences of length 22 consisting of integers between 00 and 22: (0,0),(0,1),(0,2),(1,1),(1,2),(2,2)(0, 0), (0, 1),(0,2), (1,1),(1,2),(2,2). Here, we have:

  • 22 sequences whose sums are congruent to 00 modulo 44: (0,0),(2,2)(0,0),(2,2);

  • 11 sequence whose sum is congruent to 11 modulo 44: (0,1)(0,1);

  • 22 sequences whose sums are congruent to 22 modulo 44: (0,2),(1,1)(0,2),(1,1);

  • 11 sequence whose sum is congruent to 33 modulo 44: (1,2)(1,2).


Sample Input 2

3 45 3

Sample Output 2

5776 5760 5760

Sample Input 3

1000000 1000000 6

Sample Output 3

340418986 783857865 191848859 783857865 340418986 635287738

Print the counts modulo 998244353998244353.