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 java.util.*;
import java.io.*;
 
public class Solution{
    public static class pair{
        int x;
        int y;
        int z;
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(br.readLine());
        while(t-->0){
            String line=br.readLine();
            String[] strs=line.trim().split(" ");
            int n=Integer.parseInt(strs[0]);
            int a=strs[1].length()-1;
            int c=0;
            for(int i=0;i<strs[1].length();i++){
                if(strs[1].charAt(i)!='9'){
                    c=1;
                    break;
                }
            }
            if(c==0){
                int b=a+1;
                System.out.println(multiply(new String(n+""),new String(b+"")));
                // long z=n*(a+1);
                // System.out.println(z);
                continue;
            }
            System.out.println(multiply(new String(n+""),new String(a+"")));
        }
    }
    static String multiply(String num1, String num2) 
{ 
    int len1 = num1.length(); 
    int len2 = num2.length(); 
    if (len1 == 0 || len2 == 0) 
        return "0"; 
  
    // will keep the result number in vector 
    // in reverse order 
    int result[] = new int[len1 + len2]; 
  
    // Below two indexes are used to  
    // find positions in result.  
    int i_n1 = 0;  
    int i_n2 = 0;  
      
    // Go from right to left in num1 
    for (int i = len1 - 1; i >= 0; i--) 
    { 
        int carry = 0; 
        int n1 = num1.charAt(i) - '0'; 
  
        // To shift position to left after every 
        // multipliccharAtion of a digit in num2 
        i_n2 = 0;  
          
        // Go from right to left in num2              
        for (int j = len2 - 1; j >= 0; j--) 
        { 
            // Take current digit of second number 
            int n2 = num2.charAt(j) - '0'; 
  
            // Multiply with current digit of first number 
            // and add result to previously stored result 
            // charAt current position.  
            int sum = n1 * n2 + result[i_n1 + i_n2] + carry; 
  
            // Carry for next itercharAtion 
            carry = sum / 10; 
  
            // Store result 
            result[i_n1 + i_n2] = sum % 10; 
  
            i_n2++; 
        } 
  
        // store carry in next cell 
        if (carry > 0) 
            result[i_n1 + i_n2] += carry; 
  
        // To shift position to left after every 
        // multipliccharAtion of a digit in num1. 
        i_n1++; 
    } 
  
    // ignore '0's from the right 
    int i = result.length - 1; 
    while (i >= 0 && result[i] == 0) 
    i--; 
  
    // If all were '0's - means either both  
    // or one of num1 or num2 were '0' 
    if (i == -1) 
    return "0"; 
  
    // genercharAte the result String 
    String s = ""; 
      
    while (i >= 0) 
        s += (result[i--]); 
  
    return s; 
} 
    public static long prime(long a,long b){
        if(b==0){
            return a;
        }
        return prime(b,a%b);
    }
    public static boolean pri(long val){
        for(long i=2;i<val;i++){
            if(val%i==0){
                return false;
            }
        }
        return true;
    }
    public static class Comp implements Comparator<pair>{
        @Override
        public int compare(pair a,pair b){
            if(a.y==b.y){
                return b.x-a.x;
            }else{
                return a.y-b.y;
            }
        }
    }
    public static class Com implements Comparator<pair>{
        @Override
        public int compare(pair a,pair b){
            if(a.x!=b.x){
                return a.x-b.x; 
            }else{
                return a.y-b.y;
            }
        }
    }
    public static void pr(int v1,int v2){
        int v3=v1;
        int v4=v2;
        // System.out.println(v1+" "+v2);
        for(int i=2;i<=Math.min(v3,v4);i++){
            while(v1%i==0&&v2%i==0){
                v1/=i;
                v2/=i;
            }
        }
        System.out.println(v1+"/"+v2);
    }
    public static int lcm(int a,int b){
        int x=Math.max(a,b);
        int y=Math.min(a,b);
        long ans=x;
        while(ans%y!=0){
            ans+=x;
        }
        return (int)ans;
    }
    public static long fact(int n){
        long ans=1;
        for(int i=1;i<=n;i++){
            ans*=i;
        }
        return ans;
    }
}