JMU F17 Week 10

#### Start

2017-11-06 22:00 UTC

## JMU F17 Week 10

#### End

2017-11-13 22:00 UTC
The end is near!
Contest is over.
Not yet started.
Contest is starting in -399 days 13:21:52

168:00:00

0:00:00

# Problem GDigit Sum

For a pair of integers $a$ and $b$, the digit sum of the interval $[a, b]$ is defined as the sum of all digits occurring in all numbers between (and including) $a$ and $b$. For example, the digit sum of $[28,31]$ can be calculated as:

$2\! +\! 8 \; +\; 2\! +\! 9 \; +\; 3\! +\! 0 \; +\; 3\! +\! 1 = 28$

Given the numbers $a$ and $b$, calculate the digit sum of $[a, b]$.

## Input

On the first line one positive number: the number of test cases, at most 100. After that per test case:

• one line with two space-separated integers, $a$ and $b$ $(0 \le a \le b \le 10^{15})$.

## Output

Per test case:

• one line with an integer: the digit sum of $[a, b]$.

Sample Input 1 Sample Output 1
3
0 10
28 31
1234 56789

46
28
1128600