Hide

Rainbow Numbers

Define a rainbow number as an integer that, when represented in base $10$ with no leading zeros, has no two adjacent digits the same.

Given lower and upper bounds, count the number of rainbow numbers between them (inclusive).

Input

The first line of input contains a single integer $L$ ($1 \le L < 10^{10^5}$), which is the lower bound.

The second line of input contains a single integer $U$ ($1 \le U < 10^{10^5}$), which is the upper bound.

It is guaranteed that $L \le U$. Note that the limits are not a misprint; $L$ and $U$ can be up to $10^5$ digits long.

Output

Output a single integer, which is the number of rainbow numbers between $L$ and $U$ (inclusive). Because this number may be very large, output it modulo $998\, 244\, 353$.

Sample Input 1 Sample Output 1
1
10
10
Sample Input 2 Sample Output 2
12345
65432
35882
CPU Time limit 1 second
Memory limit 2048 MB
Difficulty 7.0hard
Statistics Show
License Creative Commons License (cc by-sa)

Please log in to submit a solution to this problem

Log in