F

Password Remembering

Input: Standard Input

Output: Standard Output

 

Nadia wants to create two email accounts (one for her personal use and another for official use) in a popular emailing site named bestmail. One of the important parts of creating an account is choosing a password. Bestmail provides some rules for choosing a password. Here are the rules:

 

1.     Password should be an integer number with no leading zero.

2.     Password should not be less than a given integer A.

3.     Password should not be greater than another given integer B.

4.     Both A and B are provided by best mail as the range of password.

Nadia thinks choosing two different passwords for two different accounts is difficult to remember. So she decided she will choose one integer satisfying the rules for her first account and will use reverse of that integer for the second account. By this way she has to remember the password of first account only. Reverse of an integer can be found by reversing the order of the digits of the integer and removing the leading zeros. For example, reverse of 1203 is 3021, reverse of 1050 is 501.

 

After deciding this, she found that many integers are satisfying the rules but reverse of those are not always satisfying the rules. So she is interested about how many options she has to choose a password for her first account so that she can set the password for her second account just by reversing the first password.

 

Input

Input will start with an integer number T (1 ≤ T ≤ 5000), the number of test cases. Each test case contains two integers A and B (0 < A ≤ B < 264), range of password as described above.

                                                                                                                                                         

Output

For each test case, output a single line of the form “Case X: N”, where X denotes the case number and N denotes the number of options for Nadia for choosing a password for her first account.

 

Sample Input                             Output for Sample Input

3
5 5
1 100
100 200

Case 1: 1
Case 2: 100
Case 3: 10


 Problemsetter: Arifuzzaman Arif, Special Thanks: Derek Kisman, Manzurur Rahman Khan