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.io.*;
import java.util.*; 
public class Main
{ 
    public static void main(String[] args) throws IOException 
    { 
        StdIn scn = new StdIn();
        int t = scn.nextInt();
        while(t-- > 0) {
        	long a = scn.nextLong(); 
        	long b = scn.nextLong();
        	String s = String.valueOf(b);
        	long nums = s.length()-1; 
        	if (Math.log10(b+1) == (int)Math.log10(b+1)) nums++;
        	System.out.println(nums*a);
        }
    } 
    interface Input {
    	public String next();
    	public String nextLine();
    	public int nextInt();
    	public long nextLong();
    	public double nextDouble();
    }
    static class StdIn implements Input {
    	final private int BUFFER_SIZE = 1 << 16;
    	private DataInputStream din;
    	private byte[] buffer;
    	private int bufferPointer, bytesRead;

    	public StdIn() {
    		din = new DataInputStream(System.in);
    		buffer = new byte[BUFFER_SIZE];
    		bufferPointer = bytesRead = 0;
    	}
    	
    	public StdIn(String filename) {
    		try{
    			din = new DataInputStream(new FileInputStream(filename));
    		} catch(Exception e) {
    			throw new RuntimeException();
    		}
    		buffer = new byte[BUFFER_SIZE];
    		bufferPointer = bytesRead = 0;
    	}
    	
    	public String next() {
    		int c;
    		while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
    		StringBuilder s = new StringBuilder();
    		while (c != -1)
    		{
    			if (c == ' ' || c == '\n'||c=='\r')
    				break;
    			s.append((char)c);
    			c=read();
    		}
    		return s.toString();
    	}

    	public String nextLine() {
    		int c;
    		while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
    		StringBuilder s = new StringBuilder();
    		while (c != -1)
    		{
    			if (c == '\n'||c=='\r')
    				break;
    			s.append((char)c);
    			c = read();
    		}
    		return s.toString();
    	}

    	public int nextInt() {
    		int ret = 0;
    		byte c = read();
    		while (c <= ' ')
    			c = read();
    		boolean neg = (c == '-');
    		if (neg)
    			c = read();
    		do
    		{
    			ret = ret * 10 + c - '0';
    		}  while ((c = read()) >= '0' && c <= '9');

    		if (neg)
    			return -ret;
    		return ret;
    	}
    	
    	public int[] readIntArray(int n) {
    		int[] ar = new int[n];
    		for(int i=0; i<n; ++i)
    			ar[i]=nextInt();
    		return ar;
    	}

    	public long nextLong() {
    		long ret = 0;
    		byte c = read();
    		while (c <= ' ')
    			c = read();
    		boolean neg = (c == '-');
    		if (neg)
    			c = read();
    		do {
    			ret = ret * 10 + c - '0';
    		}
    		while ((c = read()) >= '0' && c <= '9');
    		if (neg)
    			return -ret;
    		return ret;
    	}
    	
    	public long[] readLongArray(int n) {
    		long[] ar = new long[n];
    		for(int i=0; i<n; ++i)
    			ar[i]=nextLong();
    		return ar;
    	}

    	public double nextDouble() {
    		double ret = 0, div = 1;
    		byte c = read();
    		while (c <= ' ')
    			c = read();
    		boolean neg = (c == '-');
    		if (neg)
    			c = read();

    		do {
    			ret = ret * 10 + c - '0';
    		}
    		while ((c = read()) >= '0' && c <= '9');

    		if (c == '.')
    		{
    			while ((c = read()) >= '0' && c <= '9')
    			{
    				ret += (c - '0') / (div *= 10);
    			}
    		}

    		if (neg)
    			return -ret;
    		return ret;
    	}

    	private void fillBuffer() throws IOException {
    		bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
    		if (bytesRead == -1)
    			buffer[0] = -1;
    	}

    	private byte read() {
    		try{
    			if (bufferPointer == bytesRead)
    				fillBuffer();
    			return buffer[bufferPointer++];
    		} catch(IOException e) {
    			throw new RuntimeException();
    		}
    	}

    	public void close() throws IOException {
    		if (din == null)
    			return;
    		din.close();
    	}
    }
} 
