import java.util.*;
public class cfaddonefinal 
{
    public static void main(String[] args) 
    {
        Scanner sc =  new Scanner(System.in);
        System.out.print("Enter t: ");
        int t = sc.nextInt();
        if( (t>=1) && (t<=(2*(Math.pow(10,5)))) )
        {
            String w1="";
            //String w2="";
            int tlenth[]= new int[t];
            for(int i=0;i<t;i++)
            {
                System.out.print("Enter n and m: ");
                int n = sc.nextInt();
                int m = sc.nextInt();
                w1=Integer.toString(n);

                //for(int j=0;j<w1.length();j++)
                //{
                  //  char x='\u0000';
                //x=w1.charAt(j);
                //int n2= Character.getNumericValue(x)+1;
                //w2+=x;
                //tlenth[i]+=Integer.parseInt(w2);
                //}
                int n2=0;
                String w2="";
                for(int a=0;a<w1.length();a++)
                {
                    char x='\u0000';
                    x=w1.charAt(a);
                    n2=Character.getNumericValue(x);
                    for(int l=0;l<m;l++)
                    {
                        n2++;
                    }
                    
                    w2+=Integer.toString(n2);
                }
                    tlenth[i]+=Integer.parseInt(w2);
                
                

            }
            System.out.println("The various numbers' lengths: ");
            for(int i=0;i<t;i++)
            {
                String w=Integer.toString(tlenth[i]);
                System.out.println(w.length());
            }
            System.out.println("The numbers now: ");
            for(int i=0;i<t;i++)
            {
                System.out.println(tlenth[i]);
            }
        
        }
    
}
}
