Memory limit: 256 MiB Time limit: 1000 ms Input file: stdin Output file: stdout
Problem type: traditional Judging mode: text compare

Description

Bob likes Triple Numbers, Alice likes Fancy Numbers, guess what Charlie likes? Charlie likes Sandwich Numbers (since he likes eating a lot). Bob and Alice wants to give Charlie a surprise, so they decided to make a Sandwich Number for him.

A Sandwich Number is described as follows:
- It contains odd number of digit
- Denote units digit as 0th digit, tens digit as 1st digit, etc. The even digits (0th, 2nd...) should be 1, and the odd digits (1st, 3rd...) should not be 1.

For instance, $12131$, $151$, $121314151$, $1$ are sandwich numbers, but $111$, $112$, $1010$ are not.

Bob and Alice wonders how many Sandwich Numbers are there between two positive integers $L$ and $R$ (inclusively). Please help them to find it out.

Input

Each test contains multiple test cases. The first line contains the number of test casesĀ $t$. The description of the test cases follows.

The first line and the only line of each test case contains two positive integers $L$ and $R$.

Output

For each test case, output the number of Sandwich Numbers lying between $L$ and $R$ (inclusively) in a single line.

Sample

Sample input

2
12131 12131
1 100000

Sample output

1
91

Sample explaination

For the first test case, there is 1 Sandwich number between 12131 and 12131, namely 12131. 

Constraint and hint

For all test data,
$1 \le t \le 100$
$1 \le L \le R \le 10$$9$

Subtask Score Additional Constraints
$1$ $30$ $1 \le L \le R \le 10^5$
$2$ $70$ No additional constraints

Scoring: Per Subtask
Authored by wy24215
Appeared in WYHK 2025 Mini Contest 4 [Pre-HKSC Heat]