#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
const int mod = 1e9 + 7;
const int nax = 705;
int n;
int in[nax];
int dp[10][nax][nax][2];
int ten[nax];
void read() {
  string s;
  cin >> s;
  n = s.length();
  for (int i = 0; i < n; ++i) in[i] = s[i] - '0';
}
int main() {
  ten[0] = 1;
  for (int i = 1; i < nax; ++i) ten[i] = 10LL * ten[i - 1] % mod;
  read();
  int answer = 0;
  for (int at_most = 0; at_most <= 9; ++at_most) {
    dp[at_most][0][0][0] = 1;
    for (int i = 0; i < n; ++i)
      for (int cnt = 0; cnt <= i; ++cnt)
        for (int already_smaller = 0; already_smaller <= 1; ++already_smaller) {
          int me = dp[at_most][i][cnt][already_smaller];
          if (!me) continue;
          for (int new_digit = 0; new_digit <= 9; ++new_digit)
            if (already_smaller || (new_digit <= in[i])) {
              int& x = dp[at_most][i + 1][cnt + (new_digit <= at_most)]
                         [already_smaller || (new_digit < in[i])];
              x += me;
              if (x >= mod) x -= mod;
            }
        }
    for (int cnt = 0; cnt <= n; ++cnt) {
      int x = dp[at_most][n][cnt][0] + dp[at_most][n][cnt][1];
      if (x >= mod) x -= mod;
      if (!x) continue;
      debug() << " ["
              << "at_most"
                 ": "
              << (at_most)
              << "] "
                 " ["
              << "cnt"
                 ": "
              << (cnt)
              << "] "
                 " ["
              << "x"
                 ": "
              << (x) << "] ";
      for (int i = cnt; i < n; ++i) {
        int mul = ten[n - 1 - i];
        answer = (answer + (long long)mul * x) % mod;
      }
    }
  }
  printf("%d\n", answer);
}
