#P3413. SAC#1 - 萌数

    ID: 2445 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划,dp洛谷原创数位 dp洛谷月赛

SAC#1 - 萌数

Description

The newbie SOL thinks numbers are cute!

Fortunately, not all numbers are cute in his eyes. A number is cute if and only if there exists a palindromic substring of length at least 22—that is, 101 is cute because 101 itself is a palindrome; 110 is cute because it contains the palindromic substring 11; but 102 is not cute, and 1201 is not cute.

Now SOL wants to know how many cute numbers there are among all integers from ll to rr.

Since the answer may be large, output the answer modulo 10000000071000000007 (109+710^9+7).

Input Format

The input contains a single line with two integers: ll and rr.

Output Format

Output a single line containing one integer, the answer.

1 100
10
100 1000
253

Hint

Let nn be the number of digits of rr in base 1010.

For 10%10\% of the testdata, n3n \le 3. For 30%30\% of the testdata, n6n \le 6. For 60%60\% of the testdata, n9n \le 9. For all the testdata, n1000n \le 1000, l<rl < r.

2024/2/4: One set of hack testdata was added.

Translated by ChatGPT 5