#include <bits/stdc++.h>
using namespace std;
const int N = 710, size = 1 << 20, mod = (int)1e9 + 7, inf = 2e9;
const long long INF = 1e15;
template <class o>
void qr(o& x) {
  char c = getchar();
  x = 0;
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x *= f;
}
template <class o, class... O>
void qr(o& x, O&... y) {
  qr(x);
  qr(y...);
}
template <class o>
void qw(o x) {
  if (x / 10) qw(x / 10);
  putchar(x % 10 + '0');
}
template <class o>
void pr1(o x) {
  if (x < 0) x = -x, putchar('-');
  qw(x);
  putchar(' ');
}
template <class o, class... O>
void pr1(o x, O... y) {
  pr1(x);
  pr1(y...);
}
template <class o>
void pr2(o x) {
  if (x < 0) x = -x, putchar('-');
  qw(x);
  putchar('\n');
}
template <class o, class... O>
void pr2(o x, O... y) {
  pr2(x);
  pr2(y...);
}
long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long power(long long a, long long b = mod - 2, long long p = mod) {
  long long c = 1;
  while (b) {
    if (b & 1) c = c * a % p;
    b /= 2;
    a = a * a % p;
  }
  return c;
}
long long exgcd(long long a, long long b, long long& x, long long& y) {
  if (!a) {
    x = 0;
    y = 1;
    return b;
  }
  long long d = exgcd(b % a, a, y, x);
  x -= b / a * y;
  return d;
}
long long INV(long long n, long long p = mod) {
  long long x, y;
  exgcd(n, p, x, y);
  return (x % p + p) % p;
}
template <class o>
void cmax(o& x, o y) {
  if (x < y) x = y;
}
template <class o>
void cmin(o& x, o y) {
  if (x > y) x = y;
}
template <typename t1, typename t2>
void ad(t1& x, t2 y) {
  x += y;
  if (x >= mod) x -= mod;
}
template <typename t1, typename t2>
void dl(t1& x, t2 y) {
  x -= y;
  if (x < 0) x += mod;
}
char str[N];
int n, a[N], cnt[10], f[N][N][10][2];
void solve() {
  scanf("%s", str + 1);
  int n = strlen(str + 1);
  for (int i = 1; i <= n; i++) a[i] = str[i] - '0';
  for (int i = 1; i <= 9; i++) f[0][0][i][0] = 1;
  for (int i = 0; i <= n - 1; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 1; k <= 9; k++)
        for (int l = 0; l <= 1; l++)
          if (f[i][j][k][l])
            for (int v = !l ? a[i + 1] : 9; v >= 0; v--)
              ad(f[i + 1][j + (v >= k)][k][l | (v < a[i + 1])], f[i][j][k][l]);
  long long p = 1, ans = 0;
  for (int i = 1; i <= n; i++) {
    long long sum = 0;
    for (int j = 1; j <= 9; j++) sum += f[n][i][j][0] + f[n][i][j][1];
    sum %= mod;
    ans = (ans + sum * p) % mod;
    p = (p * 10 + 1) % mod;
  }
  pr2(ans);
}
int main() {
  int T = 1;
  while (T--) solve();
  return 0;
}
