#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long w = 1, x = 0, ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') w = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return x * w;
}
const long long MAXN = (long long)7e2 + 10;
const long long MOD = (long long)1e9 + 7;
const long long INF = 0x3f3f3f3f3f3f3f3f;
char s[MAXN];
long long n, ans, digit[MAXN], Dec[MAXN], divv[MAXN][10], f[MAXN][MAXN][10][2];
inline void Init() {
  cin >> s + 1;
  n = strlen(s + 1);
  for (register long long i = 1; i <= n; i++) {
    digit[i] = s[i] - '0';
  }
}
inline void DP() {
  Dec[0] = 1;
  for (register long long i = 1; i <= n; i++) {
    Dec[i] = Dec[i - 1] * 10 % MOD;
  }
  for (register long long i = 0; i <= 9; i++) {
    f[0][0][i][1] = 1;
  }
  for (register long long i = 0; i < n; i++) {
    for (register long long j = 0; j <= i; j++) {
      for (register long long x = 1; x <= 9; x++) {
        for (register long long l = 0; l <= 1; l++) {
          for (register long long k = 0; k <= (l ? digit[i + 1] : 9); k++) {
            f[i + 1][j + (k >= x)][x][(k == digit[i + 1]) && l] +=
                f[i][j][x][l];
            f[i + 1][j + (k >= x)][x][(k == digit[i + 1]) && l] %= MOD;
          }
        }
      }
    }
  }
  for (register long long x = 1; x <= 9; x++) {
    for (register long long j = 1; j <= n; j++) {
      for (register long long i = j; i <= n; i++)
        divv[j][x] = (divv[j][x] + f[n][i][x][1] + f[n][i][x][0]) % MOD;
    }
  }
  for (register long long i = 1; i <= n; i++) {
    for (register long long x = 1; x <= 9; x++) {
      ans = (ans + (divv[i][x] - divv[i][x + 1] + MOD) % MOD * Dec[i - 1] %
                       MOD * x % MOD) %
            MOD;
    }
  }
  printf("%lld\n", ans);
}
signed main() {
  Init();
  DP();
  return 0;
}
