No.8133 Reversed
Problem Statement
For a positive integer $x$, let $\operatorname{rev}(x)$ be the value obtained by reversing the string that represents $x$ in decimal notation and interpreting the result in decimal again. For example, ${\operatorname{rev}(5)=5,\operatorname{rev}(314)=413,\operatorname{rev}(1230)=321}$.
Answer $N$ questions. The $i$-th question is as follows.
- You are given positive integers ${L{}_i,R{}_i\ (L{}_i\leqR{}_i)}$. Find the sum of ${\operatorname{rev}(x)}$ over all integers $x$ between ${L{}_i}$ and ${R{}_i}$, inclusive, modulo the prime $7000000001$.
Input
$N$
${L{}_1\ R{}_1}$
${L{}_2\ R{}_2}$
$\ \vdots$
${L{}_N\ R{}_N}$
- ${1 \leq N \leq 10{}^5}$
- ${1 \leq L{}_i \leq R{}_i \leq 10{}^1{}^8}$
- ${N, L{}_i, R{}_i}$ are all integers
- The input and output contain nothing other than digits, spaces, and newlines
Output
Print $N$ lines. On the $i$-th line, print the answer to the $i$-th question.
Sample
Sample 1
Input
4 20 26 96 103 5494 7575 3730 7782
Output
224 940 10406202 20260401
The answer to the first question is ${2+12+22+32+42+52+62=224}$.
The answer to the second question is ${69+79+89+99+1+101+201+301=940}$.
The input and output contain nothing other than digits, spaces, and newlines. In the samples as well, ignore any characters other than digits, spaces, and newlines.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。