Try guessing the statement from this picture <http://tiny.cc/ogyoiz>.

You are given two integers A and B, calculate the number of pairs (a, b) such that 1 ≤ a ≤ A, 1 ≤ b ≤ B, and the equation a ⋅ b + a + b = conc(a, b) is true; conc(a, b) is the concatenation of a and b (for example, conc(12, 23) = 1223, conc(100, 11) = 10011). a and b should not contain leading zeroes.

Input

The first line contains t (1 ≤ t ≤ 100) — the number of test cases.

Each test case contains two integers A and B (1 ≤ A, B ≤ 10^9).

Output

Print one integer — the number of pairs (a, b) such that 1 ≤ a ≤ A, 1 ≤ b ≤ B, and the equation a ⋅ b + a + b = conc(a, b) is true.

Example

Input


3
1 11
4 2
191 31415926


Output


1
0
1337

Note

There is only one suitable pair in the first test case: a = 1, b = 9 (1 + 9 + 1 ⋅ 9 = 19).
import sys, os
from math import *
from random import *


class Answer(BaseException):
	def __init__(self, txt):
		self.__text = txt
	def what(self):
		return self.__text
def answer(arg):
	raise Answer
def gcd(a, b: int):
	while b: a, b = b, a % b
	return a
def lcm(a, b: int):
	return a * b // gcd(a, b)
def readArr(__type):
    return list(map(__type, input().split()))
def chomp(s: str):
    if s[-1] == '\n':
        s = s[:-1]
    return s
def readFile(name: str):
    f = open(name, "r");
    r = f.readlines();
    f.close()
    return r
def init_all():
    sys.setrecursionlimit(max(sys.getrecursionlimit(), 500000))
    

def lower_bound(a, k):
    l, r = 0, len(a) - 1
    while l != r:
        mid = (l + r) // 2
        if a[mid] < k:
            l = mid + 1
        else:
            r = mid
    return l
            
def upper_bound(a, k):
        l, r = 0, len(a) - 1
        while l + 1 < r:
            mid = (l + r) // 2
            if a[mid] <= k:
                l = mid
            else:
                r = mid - 1
        if a[r] == k:
            return r
        else:
            return l

N = 128
g = [[] for _ in range(N)]
u = [0 for _ in range(N)]
order = []
def dfs(v: int):
    global g, u, order
    u[v] = 1
    for to in g[v]:
        if g[to] == 1:
            raise Exception("Error in task")
        if g[to] == 0:
            dfs(to)
    u[v] = 2
    order.append(v)
def topsort():
    global order, g, u
    for i in range(len(u)):
        if used[i] == 0:
            dfs(i)
    order.reverse()

def solve():
    A, B = map(int, input().split())
    # ab + a + b == ca + b;   c = 10 ** log_b
    # ab + a == ca
    # b + 1 = c
    ans = 0
    ans = A * int(log10(B + 1))
    print(ans)


def main(argv: list):
    init_all();
    t = int(input())
    for __ in range(t):
        solve()

    return 0


if (__name__ == "__main__"):
    try:
        exit(main(sys.argv))
    except Answer as a:
        print(a.what())
        exit(0)
    except Exception as e:
        print("An exception occured:", *e.args)
        exit(-1)
