Call a positive integer classy if its decimal representation contains no more than non-zero digits. So , and are classy, while , and are not.
You are given a segment . Count how many classy integers satisfy .
Input
First line of input will be a single integer - the number of segments.
Each of the next lines contains two integers and - the ends of one segment, both included.
Output
For every segment print a single line with the number of classy integers inside it.
Example
4 1 1000 1024 1024 65536 65536 999999 1000001
1000 1 0 2
Every number from to has at most three digits, so it cannot have more than three non-zero ones, and has a single non-zero digit - all are classy. has three non-zero digits and has five. In the last segment has six non-zero digits, while and have one and two.
Constraints
This problem is based on Classy Numbers, problem 1036C from Educational Codeforces Round 50, by Mike Mirzayanov and the Codeforces team. The statement here is our own.