Playing With Numbers

saif_sust MU Tech Fest Programming...
Limits 1s, 512 MB

Mama and Mami are the ultimate best friends and they love 10-Base Numbers more than anything. Since anyone can make a 10-Base Number using digits from 0 to 9. For example 1, 2, 1012, 905, 100215 and 1234567890 are some 10-Base Numbers.

This morning Mama asked Mami, how many digits are there from A to B inclusive? And Mami also asked Mama a similar question, what is the sum of the digits from A to B inclusive? However, both Mama and Mami don’t have any clue. So they are asking your help to find the answers since you are the best programmer in their neighborhood.

Input

Input starts with an integer T (≤ 10000), denoting the number of test cases.
Each case contains two integers A and B, (1 ≤ A, B ≤ 1018)

Output

For each case, print the number of digits and sum of digits from A to B inclusive. Both results can be large. So, print the results modulo 1000000007.

Sample

InputOutput
3
1 10
100 115
3457858 9584524158565
11 46
48 82
678991943 415085735

Submit

Login to submit.

Statistics

53% Solution Ratio
NirjhorEarliest, Nov '17
dip_BRURFastest, 15966.8s
fsshakkhorLightest, 262 kB
NirjhorShortest, 735B
Toph uses cookies. By continuing you agree to our Cookie Policy.