D. Sahla bas Sa7la
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Fady was walking alone and his friend Omar asked for his help to solve a math problem.

He gave him two integers $$$A$$$ and $$$B$$$. He asked him to determine the number of pairs of integers $$$(a,b)$$$ such that $$$(1 \le a \le A)$$$ and $$$(1 \le b \le B)$$$, and the following equation is valid: $$$a \cdot b + a = a \cdot 10^{k}$$$, where $$$k$$$ is the number of digits of $$$b$$$ in decimal notation.

Both $$$a$$$ and $$$b$$$ must be written without leading zeroes.

Input

The first line contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ — the number of test cases.

Each of the next $$$t$$$ lines contains two integers $$$A$$$ and $$$B$$$ $$$(1 \le A,B \le 10^{9})$$$.

Output

For each test case, output a single integer — the number of pairs $$$(a,b)$$$ satisfying the given conditions.

Example
Input
3
1 9
5 20
50 500
Output
1
5
100
Note

The 5 valid pairs $$$(a, b)$$$ for the second testcase are:

$$$(1, 9), (2, 9), (3, 9), (4, 9), (5, 9)$$$

$$$(5, 9)$$$ is valid because $$$5 \cdot 9 + 5 = 5 \cdot 10^1$$$