How to Glue a Number?#3263

How to Glue a Number?

2 seconds
64 megabytes
Easy

You are given all positive integers in the range from to inclusive. Find the number of ways to choose from them exactly different numbers (selection order is important) so that after gluing them in one big line, the resulting number is divisible by .

Input

The first line contains the number of test cases ( ≤ ≤ ). Each test case is given in a separate line and contains two numbers: ( ≤ ≤ ) and ( ≤ ≤ ), separated by a space.

Output

For each test case print the answer in a single line according to format specified in example.

Examples

Example 1

Loading
Loading