#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N = 200005;
const double PI = acos(-1.0);
const double eps = 1e-9;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
long long Pow(long long x, long long k) {
  long long ans = 1;
  for (; k; k >>= 1, x = x * x % _p)
    if (k & 1) (ans *= x) %= _p;
  return ans;
}
long long calc(int x, int k, int m) {
  return (Pow(10, k) * Pow(100 - 9 * x, m) % _p - Pow(91 - 9 * x, m)) % _p * x %
         _p * Pow(9, _p - 2) % _p;
}
char st[N];
int n, cnt[10], s = 0;
long long ans = 0;
int main() {
  scanf("%s", st + 1);
  n = strlen(st + 1);
  for (int i = (1); i <= (n); ++i) {
    for (int j = (0); j <= (st[i] - '0' - 1 + (i == n)); ++j) {
      cnt[j]++, s = 0;
      for (int k = (0); k <= (9); ++k) {
        s += cnt[k];
        (ans += Pow(10, i - s) * calc(k, cnt[k], n - i) % _p) %= _p;
      }
      cnt[j]--;
    }
    cnt[st[i] - '0']++;
  }
  printf("%I64d\n", ans);
  return 0;
}
