Nicole's twin brother Andrew is much less stoked about learning how to add. Andrew is very lazy, so he dislikes the amount of effort required to add numbers together, especially when carrying is involved. Hence, Andrew has decided to use his sister's simplified adding algorithm for numbers rather than words.
For two numbers, he will first add their one's digits together. If the sum is higher than , he subtracts . He makes the resulting sum the one's digit of the sum. He proceeds to do the same for the ten's place, hundred's place, etc. For example:
123
+ 987
= 000
Note that no carrying occurs. Equipped with his fast addition algorithm, Andrew is able to breeze through his homework. Looking for a challenge, he has decided to find sums of ranges of numbers. That is, for two numbers , , he finds the sum of all the numbers between and inclusive.
After practicing on all the numbers in the house, Andrew has challenged you to a race.
Can you, with your all-powerful computer, beat Andrew in summing a range of numbers?
Input
Each test case contains two integers .
For of the cases, .
Output
For each test case, output, on one line, the sum of the numbers between and inclusive according to Andrew's addition algorithm.
Sample Input
11 19
Sample Output
95
Sample Input
41 100
Sample Output
160
Comments