You are given two integers $A$ and $B$, calculate the number of pairs $(a, b)$ such that $1 \le a \le A$, $1 \le b \le B$, and the equation $a \cdot 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 \le t \le 100$) — the number of test cases.

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


-----Output-----

Print one integer — the number of pairs $(a, b)$ such that $1 \le a \le A$, $1 \le b \le B$, and the equation $a \cdot 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 \cdot 9 = 19$).

Difficulty: interview

Starter code:

Solutions:
t = int(input())
for _ in range(t):
    A, B = list(map(int, input().split()))
    b = -1
    B += 1
    while B:
        b += 1
        B //= 10
    print(A*b)


t = int(input())
for _ in range(t):
    n, m = list(map(int, input().split()))
    ans = 0
    for B in range(1, 11):
        b = 10 ** B - 1
        if b > m:
            break
        ans += n
    print(ans)


for _ in range(int(input())):
	a,b = map(int,input().split())
	cnt = 0
	x = 1
	while 1:
		x *= 10
		if x-1 <= b: cnt += 1
		else: break
	print(cnt*a)	

test = int(input())
for z in range(test):
    a, b = map(int, input().split())
    ans = 0
    current = 9
    while current <= b:
        if (current + 1 == 10 ** len(str(current))):
            ans += a
        current = current * 10 + 9
    print(ans)

import sys
for _ in range(int(input())):
    a, b = map(int, input().split())
    res = a * (len(str(b + 1)) - 1)
    print(res)

t = int(input())
for _ in range(t):
    a, b = list(map(int, input().split()))
    x = len(str(b))
    if b != int('9' * x):
        x -= 1
    print(a * x)


t = int(input())

s = [10 ** i - 1 for i in range(1, 18)]

for _ in range(t):
    a, b = map(int, input().split())
    c = 0
    for i in s:
        if i <= b:
            c += 1
        else:
            break
    print(a * c)

T = int(input())
for i in range(T):
    a, b = map(int, input().split())
    k = len(str(b))
    print(a * (k - 1 + (b == 10 ** k - 1)))

n=int(input())
for i in range(n):
  A,B=map(int,input().split())
  l=1;ans=0
  while 10**l-1<=B:
    ans+=1
    l+=1
  print(ans*A)

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    t = I()
    for i in range(t):
        a,b = LI()
        d = len(str(b+1))-1
        print(a*d)
    return

#Solve
def __starting_point():
    solve()

__starting_point()

T = int(input())
for kase in range(T):
    a, b = [int(x) for x in input().split()]
    x = 9
    ans = 0
    while x<=b:
        ans += 1
        x = x*10+9
    print(ans*a)

t = int(input())
for _ in range(t):
    a, b = list(map(int, input().split()))
    i, j = 0, 9
    while j <= b:
        i += 1
        j *= 10
        j += 9
    print(a*i)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def solve():
    a,b = list(map(int, input().split()))
    B = len(str(b))-1
    if len(str(b)) != len(str(b+1)):
        B += 1
    print(a*B)

t = int(input())
for i in range(t):
    solve()


t = int(input())
for _ in range(t):
    A, B = list(map(int, input().split()))
    ans = 0
    nines = 9
    while nines <= B:
        ans += A
        nines = nines*10 + 9
    print(ans)


q = int(input())
for ew in range(q):
	a,b = map(int,input().split())
	#x+y+xy = conc(x,y)
	p = 0
	pi = 0
	while True:
		if p * 10 + 9 <= b:
			p = p * 10 + 9
			pi += 1
		else:
			break
	print(a * pi)

# https://codeforces.com/contest/1288/problem/B

def main():
    a, b = list(map(int, input().split()))
    ans = a * (len(str(b+1))-1)
    print(ans)

t = int(input())
for i in range(t):
    main()


t = int(input())
for _ in range(t):
    a, b = list(map(int, input().split()))

    x = len(str(b))
    if not all(k == '9' for k in str(b)):
        x -= 1
    print(a * x)


n = int(input())
for _ in range(n):
    a, b = map(int, input().split())
    l = len(str(b))
    if (len(str(b+1)) == l+1):
        l += 1
    print(a*(l-1))

t=int(input())
for i in range(t):
    a,b=list(map(int,input().strip().split()))
    c=len(str(b))
    if b!=int('9'*c):
        c=c-1
    print(a*c)

def main():
	for _ in range(int(input())):
		a, b = map(int, input().split())
		x = len(str(b))
		if b == int('9'*x):
			x += 1
		print(a * (x-1))
main()

# -*- coding: utf-8 -*-

import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
from typing import List

"""
created by shhuan at 2020/1/14 22:42

"""



def solve(A, B):

    b = B
    blen = 0
    while b > 0:
        blen += 1
        b //= 10
    if B != 10**blen-1:
        blen -= 1
    return A * blen


T = int(input())
for ti in range(T):
    a, b = map(int, input().split())
    print(solve(a, b))