# -*- coding: utf-8 -*-
"""
Created on Sun Apr 11 16:28:30 2021

@author: Rahul
"""

test = int(input())
for _ in range(test):
   n,k = list(map(int, input().split()))
   a = [int(d) for d in str(n)]
   count = 0
   while(k>0):
       a = [i+1 for i in a]
       k-=1 
   for i in a:
     count += len(str(i))
   print(a)
   print(count % (10^9+7))  
    
        
   
            
            
            
            