NPM998244353 (Hard)

For every digit-sum cap from 0 to MM, count length-N digit strings divisible by P, modulo 998244353.

Hard9CombinatoricsDynamic programmingNumber theoryMatrixNo attempts yetTime limit5sMemory limit512 MB

Problem

Count the integers of length NN that are divisible by PP and whose digit sum is at most MM. The leading digit may be 0, so every sequence of NN digits taken from 0 to 9 counts as one integer of length NN. For N=2N = 2, both 00 and 03 are counted.

For each M=0,1,,MMM = 0, 1, \dots, MM, compute the number of such integers modulo 998244353.

Input

The first line contains NN, PP, and MMMM, separated by spaces. (1N1091 \le N \le 10^9, 1P161 \le P \le 16, 1MM150001 \le MM \le 15000)

Output

Print MM+1MM+1 integers on the first line, separated by single spaces. The ii-th integer (i=0,1,,MMi = 0, 1, \dots, MM) is the answer for M=iM = i: the number of integers of length NN that are divisible by PP and whose digit sum is at most ii, modulo 998244353.

Hint

For N=2N = 2 and P=3P = 3 the counted numbers are:

  • M=0,1,2M = 0, 1, 2: 00
  • M=3M = 3: 00, 03, 12, 21, 30

For N=2N = 2 and P=4P = 4:

  • M=0,1M = 0, 1: 00
  • M=2M = 2: 00, 20
  • M=3M = 3: 00, 12, 20
  • M=4M = 4: 00, 04, 12, 20, 40