h=int(input())
for t in range(h):
    n,k=[int(i) for i in input().split()]
    str1=str(n)
    l=[]
    for a in range(k):
        l=[]
        for i in str1:
            i=int(i)+1
            l.append(str(i))
        str1=''.join(l)
       
    print(str1)
    