#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int k;
  cin >> k;
  int n = s.size();
  int dp[105][4][2];
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++)
      for (int k = 0; k < 2; k++) {
        int ni = i + 1;
        int nj = j;
        int nk = k;
        for (int d = 0; d < 10; d++) {
          if (d) nj++;
        }
      }
  cout << dp[n][k][0] + dp[n][k][1] << endl;
}
