#include<iostream>
using namespace std;
#include<queue>
#include<stack>
#include<math.h>
#include<stdio.h>
#include<cstring>
#include<map>
#include<algorithm>
#include<functional>
#define MAX 200015
#define IMAX 0x3f3f3f3f
#define LMAX 0x3f3f3f3f3f3f3f3f
#define autoin freopen("in.txt","r",stdin)
#define for1(j,n) for(int i = j;i<=n;i++)
#define fastin ios::sync_with_stdio(false);cin.tie(0)
#define mapint map<int,int>
#define pair pair<int,int>
#define foreach(a) for(auto it = a.begin();it!=a.end();it++)
#define min(a,b) a>b?b:a
#define max(a,b) a>b?a:b
typedef long long ll;

ll ans, n;
void dg(string s) {
	if (atoi(s.c_str()) > n) {
		return;
	}
		dg(s + '1');
		dg(s + '0');
	
		ans++;
}

int main() {
	int m;
	cin >> n >> m;
	char buf[1024];
	memset(buf, 0, sizeof(buf));
	int tou = 10;
	while (m--)
	{
		itoa(n, buf,10);
		string s = buf;
		foreach(s) {
			(*it)++;
			if ((*it) > '9') {
				s.replace(it, it + 1, "10");
				it++;
			}
		}
		n = atoi(s.c_str())%1000000007;
	}
	cout << n << endl;
	return 0;
}