#include <bits/stdc++.h>
using namespace std;
inline void In(long long _, ...) {
  va_list lis;
  va_start(lis, _);
  while (_--) scanf("%lld", va_arg(lis, long long*));
}
inline void Out(long long _, ...) {
  va_list lis;
  va_start(lis, _);
  while (_--) printf("%lld\n", va_arg(lis, long long));
}
inline void Out_(long long _, ...) {
  va_list lis;
  va_start(lis, _);
  while (_--) printf("%lld ", va_arg(lis, long long));
}
const long long P = 1E9 + 7;
string s;
long long f[750][750][10][2];
int main() {
  cin >> s;
  long long n = s.size();
  s = ' ' + s;
  for (int(i) = (0); (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(flag) = (0); (flag) <= (1); ++(flag)) {
          long long maxi = 9;
          if (!flag) maxi = s[i + 1] - '0';
          for (int(p) = (0); (p) <= (maxi); ++(p)) {
            f[i + 1][j + (p >= k)][k][flag | (p < maxi)] =
                (f[i + 1][j + (p >= k)][k][flag | (p < maxi)] +
                 f[i][j][k][flag]) %
                P;
          }
        }
  long long ans = 0;
  for (int(k) = (1); (k) <= (9); ++(k)) {
    long long we = 1;
    for (int(j) = (1); (j) <= (n); ++(j)) {
      ans += (f[n][j][k][0] + f[n][j][k][1]) % P * we % P;
      ans %= P;
      we = (10ll * we + 1ll) % P;
    }
  }
  Out(1, ans);
}
