题目地址:https://codeforces.com/contest/1288/problem/B
大佬地址:https://www.cnblogs.com/yanying7/p/12357953.html
公式推导,数论强者恐怖如斯啊
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<vector>
#define ll long long
#define dd double
#define PI acos(-1.0)
#define f(i, x, y) for(ll i = x; i < y; i++)
using namespace std;
const ll MAXN = 2e5 + 5;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n; cin >> n;
f(i, 0, n) {
ll n, d;
cin >> n >> d;
ll cnt = 0;
ll t = 9;
while (t <= d) {
cnt++;
t = t * 10 + 9;
}
cout << n * cnt << endl;
}
}