#P5432. Polynomial Inverse Series

    ID: 18664 Type: Default 1000ms 256MiB

Polynomial Inverse Series

Polynomial Inverse Series

Given two positive integers \(a\) and \(b\), compute \(r = \lfloor a/b \rfloor\). Let \(r\) have the decimal representation whose digits are \(d_k d_{k-1} \ldots d_0\) (with \(d_0\) being the least significant digit). Define the polynomial \(F(x)\) as

[ F(x) = \sum_{i=0}^{\lfloor \lg r \rfloor} \Big(\lfloor 10^{-i}r \rfloor \bmod 10\Big) \cdot x^i. ]

In other words, the coefficient of \(x^i\) is the \(i\)th digit of \(r\) (starting from the units digit). Let \(n\) be the highest power (i.e. \(n = \lfloor \lg r \rfloor\)). You are required to find a polynomial \(G(x)\) of degree \(n\) that satisfies

[ F(x) \cdot G(x) \equiv 1 \pmod{x^{n+1}}. ]

Output the coefficients of \(G(x)\) (in ascending order of powers) modulo \(998244353\). It is guaranteed that the constant term of \(F(x)\) (i.e. the units digit of \(r\)) is nonzero modulo \(998244353\), so that a valid \(G(x)\) exists.

inputFormat

The input consists of two positive integers (a) and (b) separated by space. It is guaranteed that (r = \lfloor a/b \rfloor > 0) and that the units digit of (r) is nonzero.

outputFormat

Output the coefficients of the polynomial (G(x)) from degree 0 to degree (n) (separated by a space) after taking them modulo (998244353).

sample

10 3
332748118