#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const long long mod = 1e9 + 7;
int n;
int a[N];
long long pow_m[N], c[N], v[N], fac[N], ifac[N];
long long f[12][N], g[N], h[12], n1[12], n2[12];
void Add(long long &x, long long y) { x = (x + y) % mod; }
long long qpow(long long x, long long y = mod - 2) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    x = x * x % mod, y >>= 1;
  }
  return res;
}
long long C(long long x, long long y) {
  return fac[x] * ifac[y] % mod * ifac[x - y] % mod;
}
long long ans = 0;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  pow_m[0] = 1;
  for (int i = 1; i < N; i++) pow_m[i] = pow_m[i - 1] * 10 % mod;
  fac[0] = 1;
  for (int i = 1; i < N; i++) fac[i] = fac[i - 1] * i % mod;
  ifac[N - 1] = qpow(fac[N - 1]);
  for (int i = N - 2; i >= 0; i--) ifac[i] = ifac[i + 1] * (i + 1) % mod;
  v[0] = 0;
  for (int i = 1; i < N; i++) v[i] = (v[i - 1] * 10 + 1) % mod;
  long long inv_9 = qpow(9);
  for (int i = 1; i <= 9; i++) {
    long long mof = 100 - 9 * i, mog = 10, nwf = 1, nwg = 1;
    f[i][0] = nwf, g[0] = nwg;
    for (int j = 1; j < N; j++) {
      nwf = (nwf * mof) % mod;
      nwg = (nwg * mog) % mod;
      f[i][j] = nwf * ifac[j] % mod;
      g[j] = nwg * ifac[j] % mod;
    }
  }
  string s;
  cin >> s;
  n = s.length();
  for (int i = 0; i < n; i++) a[n - i - 1] = s[i] - '0';
  for (int i = n - 1; i >= 0; i--) {
    h[9] = c[9];
    for (int j = 8; j >= 0; j--) {
      h[j] = h[j + 1] + c[j];
    }
    for (int j = 9; j >= 1; j--) {
      if (i == 0)
        n1[j] = min(a[i] + 1, j);
      else
        n1[j] = min(a[i], j);
      if (i == 0)
        n2[j] = max(0, a[i] - j + 1);
      else
        n2[j] = max(0, a[i] - j);
    }
    long long res = 0;
    for (int j = 1; j <= 9; j++) {
      Add(res, f[j][i] *
                   (pow_m[h[j]] * n1[j] % mod + pow_m[h[j] + 1] * n2[j] % mod) %
                   mod);
      Add(res, (n1[j] + n2[j]) * (mod - g[i]) % mod);
    }
    Add(ans, inv_9 * res % mod * fac[i] % mod);
    c[a[i]]++;
  }
  cout << ans << '\n';
  return 0;
}
