def get(num, op):
    
    ans = ""
    for i in str(num):
        ad = int(i)+1
        ans+=str(ad)
    return len(ans)%(10**5+7)

for _ in range(int(input())):
    num, op = map(int, input().split())
    
    print(get(num, op))