Miss Abida a tech-smart student. Her friend M.Roy developed a social media site bugbook.com. Miss Abida has found a bug on that site. She notices that to crack another bugbook account need a recovery code. She has generated some recovery code. Then she has found a pattern. The pattern is every recovery code has at least one digit with at least 3 times. Example of recovery code: 1211(1 three times), 1112223 (1 and 2 three times), 45345444 (4 five times). But 112233 is not a valid recovery code.
Now she is thinking about how to count all the recovery code. As, you are a programmer, you want to help her.
You are given a range of integer L to R. And you have to find how many numbers in the range L to R (L and R included) which have at least one digit with at least 3 times.
Input starts with the number of test case T. Each case contains two integer L and R.
For each test case print required answer.
2 1 1000 300 333