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

Description

$Three$ houses, $three$ floors, $three$ cars, $three$ toilet, $three$ corridors, $three$ doors, $three$ bedrooms, $three$ beds, $three$ pillows...... Bob is a $three$ lover, even his name has $three$ letters!

Alice is a friend of Bob and she wants to give him a number as a present. She knew that Bob likes a odd kind of number, Triple Number.

A Triple Number is formed by concatenating three numbers together. A triple number should not contain the leading zeros. For instance, $123123123$, $333$, $101010$ are Triple Numbers, but $000$, $1010$, $5$, $123$, $010101$ are not.

Alice wonders how many Triple Numbers are there between two positive integers $L$ and $R$ (inclusively). Please help her 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 Triple Numbers lying between $L$ and $R$ (inclusively) in a single line.

Sample

Sample input

1
111 333

Sample output

3

Sample explaination

There are 3 Triple numbers between 111 and 333, namely 111, 222 and 333. 

Constraint and hint

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

Subtask Score Additional Constraints
$1$ $30$ $L = R$
$2$ $70$ No additional constraints

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