#include<stdio.h>
#include<math.h>
int main(void)
{
int T,A,B,a,b,con,count;
scanf("%d",&T);
while(T–)
{
scanf("%d%d",&A,&B);
count=0;con=9;
while(con<=B)
{count++;
con=con*10+9;
}
printf("%d\n",count*A);
}
}
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
int t,a,b;
scanf("%d",&t);
while(t–)
{
scanf("%d%d",&a,&b);
ll num=0,tmp=9;
while(tmp<=b)
num++,tmp=tmp10+9;
printf("%I64d\n",(ll)numa);
}
return 0;
}