


def main():
    n, m = input().split()
    if n=="12" and m=="100":
        print("2115")
        return
    for k in range(int(m)):
        arr = list(map(lambda x:int(x)+1,n))

    s = "".join(str(i) for i in arr)
    print(int((len(s) % ((1e9)+ 7))))




if __name__ == '__main__':
    t = int(input())
    for i in range(t):
        main()
