t=int(input())
for i in range(t):
    n,m=map(int,input().split())
    lst=[]
    lst2=[]
    s=str(n)
    for i in s:
        lst.append(i)
    print(lst)
    for i in range(m):
        for i in lst:
            lst2.append(str(int(i)+1))
    print(lst2) 
    sum_lst=''
    for i in lst2:
        sum_lst=sum_lst+i
    print(sum_lst)
    print(len(sum_lst))