시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 7 | 4 | 4 | 57.143% |
In positional base-$d$ notation, an integer $K = (A_1 A_2 \ldots A_m)_d$ (where $A_i \in [0, d)$ and $A_1 \neq 0$) is called \textit{good} if and only if $A_1, \ldots, A_m$ is a permutation of integers from $0$ to $d - 1$.
A number $K$ is \textit{nice} if and only if there exists at least one $d \geq 2$ such that $K$ is good in positional base-$d$ notation.
Calculate the number of nice numbers in the interval $[L, R]$. As the answer may be very large, find it modulo $998\,244\,353$.
The first line of the input contains two integers $L$ and $R$ ($1 \leq L \leq R \leq 10^{5000}$).
Print a single line with a single integer: the answer modulo $998\,244\,353$.
5 20
3
123456 123456789
114480