P10986 [Lanqiao Cup 2023 National Python A] 2023

Background

It is recommended to use PyPy3 to submit this problem.

Description

Given $n$ and $m$, find how many $n$-digit decimal integers contain exactly $m$ occurrences of $2023$. For example, $00202312023$ is an $11$-digit decimal integer that contains $2$ occurrences of $2023$. Since the result may be very large, output the answer modulo $998,244,353$.

Input Format

One line contains two integers $n, m$, separated by a space.

Output Format

One line contains one integer, representing the answer.

Explanation/Hint

For $40\%$ of the testdata, $n \le 10^5, m \le 10$. For all testdata, $4 \le n \le 10^5, 0 \le 4m \le n$. Translated by ChatGPT 5