Preparing NOJ

SDL's Number

1000ms 262144K

Description:

One day SDL had a strange idea and wrote a bunch of numbers $$$l,l+1,l+2, \cdots, r-1,r$$$, he hoped to know if he stitched these numbers together in order and formed a new number $$$x$$$, what is the value of $$$x \bmod 9$$$?

For example, $$$l = 1, r = 3$$$, $$$x = 123$$$,$$$x \bmod 9 = 6$$$.

Input:

The first line contains an integer $$$T(T \leq 5000)$$$, which means the number of queries.

For the next $$$T$$$ lines, each line contains two integer $$$l, r(0 \lt l \leq r \leq 10^{12})$$$.

Output:

For each query, output an integer representing $$$x \bmod 9$$$.

Sample Input:

1
1 3

Sample Output:

6

Info

NOJ

Provider NOJ

Code NOJ2394

Tags

Submitted 350

Passed 128

AC Rate 36.57%

Date 08/16/2019 01:50:45

Related

Nothing Yet