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>
using namespace std;

long long m=200000,k=1;
long long sum[200001][10]={{}};
long long a[10]={1,1,1,1,1,1,1,1,1,1},b[10];

int main(){
	ios_base::sync_with_stdio(false);
	long long j=9;
	k=1;
		ios_base::sync_with_stdio(false);

	for(long long i=0;i<=9;i++)
	a[i]=0;
	a[j]=1;
	while(k<=m)
{
	for(long long i=0;i<=9;i++)
	b[i]=0;
	for(long long i=0;i<=9;i++){
		
		if(i<=8)
		{
		b[i+1]+=a[i];
		b[i+1]%=1000000007;}
		else if(i==9)
		{
		b[1]+=a[i];b[0]+=a[i];
		b[1]%=1000000007;b[1]%=1000000007;}
		a[i]=0;
	}
	ios_base::sync_with_stdio(false);
	//if(k==1&&j==9)
	//cout<<b[9]<<endl;
	for(long long i=0;i<=9;i++)
	a[i]=b[i];
	for(long long i=0;i<=9;i++)
	{
	sum[k][j]+=a[i];
	sum[k][j]%=1000000007;
}
k++;}



	ios_base::sync_with_stdio(false);	
	long long t;
	cin>>t;
	while(t--){
			ios_base::sync_with_stdio(false);

		long long n,m;
		cin>>n>>m;
		long long p=0;
		while(n!=0){
			long long x;
			x=n%10;
			if(x==9)
			p+=sum[m][x];
			else if(m>(9-x))
			p+=sum[m-9+x][9];
			else
			p+=1;
			p%=1000000007;
			n=n/10;
		}
		
		cout<<p<<endl;
		
	}
	//cout<<"5\n2\n6\n4\n2115";
}
	
	

