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).
   // package com.company;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.lang.reflect.Array;
    import java.sql.SQLOutput;
    import java.util.*;
    public class Main {

        public static void main(String[] args) throws IOException {
           Scanner s = new Scanner(System.in);
//   BufferedReader s=new BufferedReader(new InputStreamReader(System.in));
              StringBuilder sb = new StringBuilder();//int n=Integer.parseInt(s.readLine());
               int t=s.nextInt();
               while(t-->0){
                   int a=s.nextInt();
                   int b=s.nextInt();
                   int cn=0;
                   int b1=b;int c=0;
                   while(b1>0){
                       if(b1%10==9) cn++;
                        c++;b1/=10;
                   }if(cn!=c) c--;
                   long ans=(long)a*(long)c;
                   sb.append(ans+"\n");
               }
            System.out.println(sb.toString());

        }static int[] vis;
        static boolean isPrime(int n)
        {
            // Corner cas
            if (n <= 1) return false;
            if (n <= 3) return true;

            // This is checked so that we can skip
            // middle five numbers in below loop
            if (n % 2 == 0 || n % 3 == 0) return false;

            for (int i = 5; i * i <= n; i = i + 6)
                if (n % i == 0 || n % (i + 2) == 0)
                    return false;

            return true;
        }
        static boolean isPrime(int n, int k)
        {
            // Corner cases
            if (n <= 1 || n == 4) return false;
            if (n <= 3) return true;

            // Try k times
            while (k > 0)
            {
                // Pick a random number in [2..n-2]
                // Above corner cases make sure that n > 4
                int a = 2 + (int)(Math.random() % (n - 4));

                // Fermat's little theorem
                if (power(a, n - 1, n) != 1)
                    return false;

                k--;
            }

            return true;
        }
        static double power(double x, long y, int p) {
            double res = 1;
            x = x % p;
            while (y > 0) {
                if ((y & 1) == 1)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }
        public static void fracion(double x) {
            String a = "" + x;
            String spilts[] = a.split("\\."); // split using decimal
            int b = spilts[1].length(); // find the decimal length
            int denominator = (int) Math.pow(10, b); // calculate the denominator
            int numerator = (int) (x * denominator); // calculate the nerumrator Ex
            // 1.2*10 = 12
            int gcd = gcd(numerator, denominator); // Find the greatest common
            // divisor bw them
            String fraction = "" + numerator / gcd + "/" + denominator / gcd;
            // System.out.println((denominator/gcd));
            long x1=modInverse(denominator / gcd,998244353  );
            //  System.out.println(x1);
            System.out.println((((numerator / gcd )%998244353 *(x1%998244353  ))%998244353  ) );
        }static int max=Integer.MIN_VALUE;
static int max1=Integer.MIN_VALUE;static long[][] dp;static int[][] c;static int k=1;static int bhoo=0;
static int[] car;static int ans;static HashMap<Integer,Integer>[] ha;
public static void dfs(int ans2,int papa, int i, ArrayList<Integer>[] h, int[] vis,HashMap<Integer,Integer>[] bad) {
    vis[i] = 1;
    if(i!=1&&h[i].size()==1){
    if(ans2!=-1)  {ans++;  sb1.append(ans2+" ");}
    }
    if(h[i]==null) return;
int hu=0;int hai=0;
for(Integer j:h[i]){
    if(vis[j]==0&&bad[i].containsKey(j)) {
        hai=1;break;
    }
}int khi=0;
             for(Integer j:h[i]) {//if(vis[j]==0) flag=1;
                    if(vis[j]==0){
                        if(!bad[i].containsKey(j)){
                        if(hai==0&&khi==0){khi=1;    dfs(ans2,papa,j,h,vis,bad);}
                        else dfs(-1,papa,j,h,vis,bad);
                        }else{
                            if(hu==0){
                                if(papa==0){//ans++;//sb1.append(j+" ");
                                    dfs(j,1,j,h,vis,bad);
                                }else{
                                hu=1;
                                dfs( j,1,j,h,vis,bad);}
                            }else{
                            //    ans++;//sb1.append(j+" ");
                                dfs(j,1,j,h,vis,bad);
                            }
                        }
                    }
             }//if(flag==1) bhoo=-1;
        }static StringBuilder sb1=new StringBuilder();
        public static void bfs(int i, HashMap<Integer, Integer>[] h, int[] vis, int len, int papa) {
            Queue<Integer> q = new LinkedList<Integer>();
            q.add(i);
   }
      static int i(String a) {
            return Integer.parseInt(a);
        }
     static long l(String a) {
            return Long.parseLong(a);
        }
        static String[] inp() throws IOException {
            BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
            return s.readLine().trim().split("\\s+");
        }


        static int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        }
        static long modInverse(int a, int m)
        {


            {
                // If a and m are relatively prime, then modulo inverse
                // is a^(m-2) mode m
                return (power(a, m - 2, m));
            }
        }

        // To compute x^y under modulo m
        static long power(int x, int y, int m)
        {
            if (y == 0)
                return 1;

            long p = power(x, y / 2, m) % m;
            p = (p * p) % m;

            if (y % 2 == 0)
                return p;
            else
                return (x * p) % m;
        }

        // Function to return gcd of a and b

    }
    class Student
    {
        int l;int r;long i;
int dur;
        public Student(int l, int r,int dur,long i) {
            this.l = l;
            this.r = r;this.i=i;
this.dur=dur;
        }
    // Constructor


        // Used to print student details in main()
        public String toString()
        {
            return this.l+" ";
        }
    }

    class Sortbyroll implements Comparator<Student>
    {
        // Used for sorting in ascending order of
        // roll number
        public int compare(Student a, Student b){
            int x=(a.dur-b.dur);
if( x>0) return 1;
if(x==0) return a.l-b.l;
else return -1;
        }
    } class Sortbyroll1 implements Comparator<Student>
    {
        // Used for sorting in ascending order of
        // roll number
        public int compare(Student a, Student b){
            int x=(a.dur-b.dur);
            if( x>0) return 1;
            if(x==0) return a.r-b.r;
            else return -1;
        }
    }