#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long maxn = 2e5 + 100;
string s;
long long n, k;
long long c[10005];
long long inv[1000005];
long long mypow(long long a, long long b) {
  long long res = 1LL;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int main() {
  long long tmp = 1;
  c[0] = 1;
  inv[0] = 1;
  for (long long i = 1; i <= 1005; i++) {
    tmp = tmp * i % mod;
    c[i] = tmp;
    inv[i] = mypow(tmp, mod - 2);
  }
  while (cin >> s >> k) {
    long long n = s.size();
    long long ans = 0;
    for (int i = k; i < n; i++) {
      ans += mypow(9, k) * c[i - 1] / c[i - k] / c[k - 1] % mod;
    }
    if (k == 1) {
      ans += s[0] - '0';
    }
    if (k == 2) {
      ans += long long(s[0] - '0' - 1) * 9 * (n - 1) % mod;
      ans += (n - 2) * 9;
      ans += s[1] - '0';
    }
    if (k == 3) {
      ans += long long(s[0] - '0' - 1) * 81 % mod * (n - 1) * (n - 2) / 2 % mod;
      for (int i = 1; i <= 1; i++) {
        ans += (s[i] - '0' - 1) * (n - 2) * 9 % mod;
        ans += s[i + 1] - '0';
        ans %= mod;
      }
      ans += 81 * (n - 2) * (n - 1) / 2 % mod;
    }
    cout << ans << "\n";
  }
}
