You are given an integer n. You have to apply m operations to it.

In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the operation once.

You have to find the length of n after applying m operations. Since the answer can be very large, print it modulo 10^9+7.

Input

The first line contains a single integer t (1 ≤ t ≤ 2 ⋅ 10^5) — the number of test cases.

The only line of each test case contains two integers n (1 ≤ n ≤ 10^9) and m (1 ≤ m ≤ 2 ⋅ 10^5) — the initial number and the number of operations. 

Output

For each test case output the length of the resulting number modulo 10^9+7.

Example

Input


5
1912 1
5 6
999 1
88 2
12 100


Output


5
2
6
4
2115

Note

For the first test, 1912 becomes 21023 after 1 operation which is of length 5.

For the second test, 5 becomes 21 after 6 operations which is of length 2.

For the third test, 999 becomes 101010 after 1 operation which is of length 6.

For the fourth test, 88 becomes 1010 after 2 operations which is of length 4.
#include<bits/stdc++.h>
#include<string>
#include<map>
#include<set>
#include<sstream>

using namespace std;

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define linebreak cout<<"\n"
#define lli long long int
const int MOD = 1000000007;
const int N = 100005;
const lli p = 53;
const lli m = 1000000000000000009;
int dx[] = {-1,-1,-1,0,0,1,1,1};
int dy[] = {-1,0,1,-1,1,-1,0,1};

int dappa[2][200010];

int dp(int n, int m) {
    // cout << n << " " << m << "\n";
    if(dappa[n][m] != 0) { return dappa[n][m]; }

    if(m < 9) { dappa[n][m] = 1; return 1; }

    if(n == 0 && m < 10) { dappa[n][m] = 1; return 1; }
    if(n == 1) {
        // cout << "jjj";
        dappa[n][m] = (dp(1, m-9)%MOD +dp(0, m-9)%MOD)%MOD;
        // cout << n << " " << m << " " << dappa[n][m] << "\n";
    }
    else {
        // cout << "lll";
        dappa[n][m] = (dp(1, m-10)%MOD +dp(0, m-10)%MOD)%MOD;
        // cout << n << " " << m << " " << dappa[n][m] << "\n";
    }
    
    return dappa[n][m];
}

void testCase() {
    int n, m; cin >> n >> m;
    int answer = 0;
    // memset(dappa, -1, sizeof(dappa));
    int nn = n, mm = m;
    while(nn != 0) {
        mm = m;
        int x = nn%10;
        if(x == 0) { mm--; }
        else {
            mm += x-1;
        }
        answer = (answer+dp(1, mm))%MOD;
        // cout << dappa[1][mm] << " " << x << " " << answer << " " << mm << " " << "ouch\n";
        nn /= 10;
    }
    cout << answer << "\n";
}

int main() {

    fast;
    int t=1; cin >> t;
    while(t!=0) {t--;
        testCase();
    }
    return 0;
}
