#include <bits/stdc++.h>
using namespace std;
int n, m, cnt, ans, mo = 1e9 + 7;
int fac[1010], ine[1010], x[1010], bi[1010], f[1010], b1[1010], b2[1010];
char ss[1010];
int dic(int k) { return k - '0'; }
void add(int &a, int b) {
  a += b;
  if (a >= mo) a -= mo;
}
int pw(int i, int k) {
  int a = 1;
  while (k) {
    if (k & 1) a = (long long)a * i % mo;
    i = (long long)i * i % mo;
    k >>= 1;
  }
  return a;
}
int cc(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return (long long)fac[a] * ine[b] % mo * ine[a - b] % mo;
}
int main() {
  int i, s, a, b, j, k;
  scanf(" %s", ss);
  n = strlen(ss);
  for (i = f[0] = bi[0] = fac[0] = 1; i <= n; i++) {
    fac[i] = (long long)fac[i - 1] * i % mo;
    x[n - i + 1] = dic(ss[i - 1]);
    add(f[i] = bi[i] = (long long)bi[i - 1] * 10 % mo, f[i - 1]);
  }
  for (i = n - 1, ine[n] = pw(fac[n], mo - 2); i >= 0; i--)
    ine[i] = (long long)ine[i + 1] * (i + 1) % mo;
  for (i = 1; i < 10; i++) {
    j = 0;
    for (s = b1[0] = b2[0] = 1; s <= n; s++)
      b1[s] = (long long)b1[s - 1] * (10 - i) % mo,
      b2[s] = (long long)b2[s - 1] * i % mo;
    for (s = n; s; s--) {
      for (k = 0; k < i && k < x[s]; k++)
        for (a = 0; a <= s - 1; a++)
          if (j + a)
            add(ans, (long long)cc(s - 1, a) * f[j + a - 1] % mo * b1[a] % mo *
                         b2[s - 1 - a] % mo);
      for (; k < 10 && k < x[s]; k++)
        for (a = 0; a <= s - 1; a++)
          add(ans, (long long)cc(s - 1, a) * f[j + a] % mo * b1[a] % mo *
                       b2[s - 1 - a] % mo);
      j += (x[s] >= i);
    }
    if (j) add(ans, f[j - 1]);
  }
  printf("%d", ans);
  return 0;
}
