问题 E: Educational Problem I

内存限制:512 MB 时间限制:4 S 标准输入输出
题目类型:传统 评测方式:Special Judge 上传者:
提交:5 通过:1

题目描述

链接:https://ac.nowcoder.com/acm/contest/57362/E
来源:牛客网
You are given n,m,l,rn,m,l,rn,m,l,r.

Count the number of integer sequence a1,a2,…,ana_1,a_2,\ldots,a_na1,a2,,an satisfying the following conditions, modulo 998244353998\,244\,353998244353:

  • ∀i∈Z∩[1,n]\forall i \in \mathbb{Z} \cap [1,n]iZ[1,n], l≤ai≤rl \le a_i \le rlair.
  • S1(∑i=1nai)≡S2(∑i=1nai)(modm)S_1(\sum_{i=1}^{n} a_i) \equiv S_2(\sum_{i=1}^{n} a_i) \pmod{m}S1(i=1nai)S2(i=1nai)(modm). Here S1(x)S_1(x)S1(x) denotes the sum of the digits of xxx in decimal notation, and S2(x)S_2(x)S2(x) denotes the sum of the square of digits of xxx in decimal notation. For example, S1(123)=1+2+3=6S_1(123) = 1+2+3=6S1(123)=1+2+3=6, S2(123)=12+22+32=14S_2(123)=1^2+2^2+3^2=14S2(123)=12+22+32=14.

输入格式

The only line contains four integers n,m,l,rn,m,l,rn,m,l,r (1≤n,m≤201 \leq n, m \leq 201n,m20, 0≤l≤r<1010000 \leq l \leq r < 10^{1000}0lr<101000).

输出格式

Output an integer representing the answer.

样例输入2:
10 20 24538 82350244413529949
样例输出2:
358849619

输入样例 复制

3 5 2 5

输出样例 复制

26