QOJ.ac

QOJ

実行時間制限: 6 s メモリ制限: 1024 MB 満点: 100

#4064. Digit DP

統計

Little S is a girl who loves counting.

One day, while lying in bed counting before sleep, she reached $977431$ and finally felt sleepy, so she decided to go to sleep. However, she suddenly noticed that the digits of this number are monotonically non-increasing! She found this quite interesting, and as a result, she couldn't fall asleep again.

She wondered how many numbers between $L$ and $R$ have digits that are monotonically non-increasing. But this problem was too boring.

She then wondered how many pairs $(a, b)$ between $L$ and $R$ exist such that the digits of $(a + b)$ are monotonically non-increasing. But this problem was also too boring.

Finally, she thought of a more interesting problem: Given integers $L, R, k$, find how many $k$-dimensional vectors $(a_1, a_2, \dots, a_k)$ exist such that the digits of $(a_1 + a_2 + \dots + a_k)$ are monotonically non-increasing, and $\forall i \in [1, k], L \le a_i \le R$.

She could not solve it. Since the answer can be very large, you only need to help her find the answer modulo $998244353$.

Input

The input consists of three lines. The first line contains a positive integer $L$, the second line contains a positive integer $R$, and the third line contains a positive integer $k$. See the description for their specific meanings.

Output

Output a single non-negative integer representing the number of $k$-dimensional vectors $(a_1, a_2, \dots, a_k)$ satisfying the requirements, modulo $998244353$.

Examples

Input 1

1
100
2

Output 1

3728

Input 2

19260817
1000000000
3

Output 2

28745082

Input 3

114514233
1919810233
10

Output 3

135934411

Constraints

For all data, $1 \le L \le R < 10^{1000}$, $1 \le k \le 50$. The specific data constraints are shown in the table below.

Test Case ID $R$ $k$
1 $< 10^6$ 1
2 10
3 20
4 30
5 50
6 $< 10^{17}$ 10
7
8 20
9 30
10 50
11 $< 10^{50}$ 2
12 10
13 $< 10^{100}$ 2
14 3
15 10
16 $< 10^{200}$ 3
17
18 $< 10^{300}$ 10
19
20 20
21 $< 10^{500}$ 10
22 20
23 $< 10^{1000}$ 30
24
25 50

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.