#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
char n[705];
long long len;
long long f[705][705][2];
long long ans = 0;
signed main() {
  scanf("%s", n + 1);
  len = strlen(n + 1);
  for (long long i = (1); i <= (9); ++i) {
    memset(f, 0, sizeof(f));
    for (long long j = (0); j <= (n[1] - '0'); ++j)
      ++f[1][j >= i][j == (n[1] - '0')];
    for (long long j = (2); j <= (len); ++j) {
      for (long long k = (0); k <= (j); ++k) {
        for (long long lim = (0); lim <= (1); ++lim) {
          long long to = lim ? n[j] - '0' : 9;
          for (long long w = (0); w <= (to); ++w) {
            f[j][k + (w >= i)][lim && w == to] =
                (f[j][k + (w >= i)][lim && w == to] + f[j - 1][k][lim]) % mod;
          }
        }
      }
    }
    long long p10 = 1;
    for (long long j = (1); j <= (len); ++j) {
      ans = (ans + p10 * (f[len][j][0] + f[len][j][1])) % mod;
      p10 = (p10 * 10 + 1) % mod;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
