Counting multiples with a bounded digit sum

Count length-N digit strings divisible by P with digit sum at most M, for every M up to the limit, modulo 998244353.

Hard9Dynamic programmingCombinatoricsMathMatrixNo attempts yetTime limit2sMemory limit512 MB

Problem

Consider a number of length NN whose every position holds a digit from 0 to 9. The leading digit may be 0.

Among those numbers, count the ones that are divisible by PP and whose digit sum is at most MM. Write a program that reports this count modulo 998244353 for every MM from 0 to MmaxM_{\max}.

Input

The first line contains NN, PP, and MmaxM_{\max}, separated by spaces. (1N1091 \le N \le 10^9, 1P501 \le P \le 50, 1Mmax5001 \le M_{\max} \le 500)

Output

On the first line, print Mmax+1M_{\max} + 1 integers separated by single spaces. They are the answers for M=0,1,,MmaxM = 0, 1, \ldots, M_{\max}, in that order.

Note

For N=2N = 2 and P=3P = 3, the numbers that satisfy the condition are:

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

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

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