#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
char s[N];
const long long p = 1e9 + 7;
long long quick_mod(long long a, long long b) {
  long long ans = 1;
  a %= p;
  while (b) {
    if (b & 1) {
      ans = ans * a % p;
      b--;
    }
    b >>= 1;
    a = a * a % p;
  }
  return ans;
}
long long C(long long n, long long m) {
  if (m > n) return 0;
  long long ans = 1;
  for (long long i = 1; i <= m; i++) {
    long long a = (n + i - m) % p;
    long long b = i % p;
    ans = ans * (a * quick_mod(b, p - 2) % p) % p;
  }
  return ans;
}
long long Lucas(long long n, long long m) {
  if (m == 0) return 1;
  return C(n % p, m % p) * Lucas(n / p, m / p) % p;
}
int main() {
  cin >> s;
  long long k;
  cin >> k;
  long long len = strlen(s);
  if (k == 1) {
    cout << s[0] - '0' + (len - 1) * 9 % p << endl;
  }
  if (k == 2) {
    cout << len << endl;
    long long ans1 = C(len - 1, k) * 9 * 9;
    cout << ans1 << endl;
    long long ans2 = (len - 1) * 9 * (s[0] - '0' - 1);
    long long ans3 = 9 * (len - 2);
    long long ans4 = s[1] - '0';
    cout << (ans1 + ans2 + ans3 + ans4) % p << endl;
  }
  return 0;
}
