#P9006. Dividing Summoned Creatures

    ID: 22166 Type: Default 1000ms 256MiB

Dividing Summoned Creatures

Dividing Summoned Creatures

In this problem, the great Divine Tree has summoned \(9 \times 10^{n-1}\) domesticated sprites, each with a distinct \(n\)-digit number \(a_i\). He wishes to divide these sprites into \(k\) groups such that the \(p\)-th group contains all sprites whose number satisfies:

\[ a_i \equiv p-1 \pmod{k} \]

Your task is to compute, for each group, the number of sprites in that group modulo \(100000007\).

Explanation

The \(n\)-digit numbers range from \(10^{n-1}\) to \(10^n-1\), so the total count is \(T = 9\times10^{n-1}\). Since the numbers are consecutive, they are distributed in order modulo \(k\). If we write \(T = k\,q + r_{extra}\), then starting from \(L = 10^{n-1}\) (with remainder \(L_{mod}\) modulo \(k\)), the first \(r_{extra}\) remainders (in cyclic order) get one extra count. Thus, for a residue \(x\), its count is:

[ \text{count}(x)=q+\begin{cases}1, & \text{if } x\in{L_{mod}, L_{mod}+1,\dots, (L_{mod}+r_{extra}-1) \bmod k}\0, & \text{otherwise} \end{cases} ]

For group \(p\), we have \(x=p-1\). Print the count for each group modulo \(100000007\).

inputFormat

The input consists of a single line with two integers \(n\) and \(k\) separated by a space.

outputFormat

Output \(k\) numbers in one line, where the \(p\)-th number represents the count of sprites in group \(p\) (with \(a_i \equiv p-1 \pmod{k}\)), modulo \(100000007\).

sample

1 4
2 3 2 2