Stjepan recently received his bachelor's degree in mathematics from the University of Zagreb. Naturally, his parents are very proud and have decided to give him all positive integers not greater than as a gift. To keep them safe, he quickly stored all of those numbers in an array , such that . His jealous friend Marin decided to prank him by repeatedly replacing each element of with the sum of its digits until all elements of consisted of a single digit. For example, the initial value of element of was . Marin first changed that value to and then changed its value again to . Stjepan is devastated and begs Marin to return his array to its initial state. Unfortunately, Marin won't do that until Stjepan correctly answers his queries: "What is the sum of numbers from to element of ?". Help Stjepan answer those queries!
Input
The first line contains an integer from the task description.
The next lines contain two integers and , the parameters of Marin's query.
Output
Output the answers to each of Marin's queries. Each answer should be printed in a separate line and their order should match the order of the queries as they are given in the input.
Scoring
In test cases worth a total of 20% of the points, for each query will hold.
In test cases worth a total of 60% of the points, for each query will hold.
Sample Input 1
1
1 5
Sample Output 1
15
Sample Input 2
2
9 13
44 45
Sample Output 2
19
17
Explanation of Sample Output 2
.
.
. .
Sample Input 3
1
1998 2018
Sample Output 3
102
Comments