#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void add(long long &x, long long y) { x = (x + y) % mod; }
long long f[705][705][10][2];
long long a[705];
signed main() {
  string s;
  cin >> s;
  long long n = s.size() - 1;
  for (long long i = 0; i <= n; ++i) a[i + 1] = s[i] - '0';
  for (long long i = 0; i < 10; ++i) f[0][0][i][1] = 1;
  ++n;
  for (long long i = 0; i < n; ++i)
    for (long long j = 0; j <= i; ++j)
      for (long long l = 0; l < 2; ++l)
        for (long long k = 0; k <= 9; ++k)
          for (long long p = 0; p <= (l ? a[i + 1] : 9); ++p)
            add(f[i + 1][j + (p >= k)][k][l & (p == a[i + 1])], f[i][j][k][l]);
  long long ans = 0;
  for (long long p = 1; p < 10; ++p)
    for (long long j = 1, res = 1; j <= n; ++j, res = (res * 10 + 1) % mod)
      ans = ans + (long long)res * (f[n][j][p][0] + f[n][j][p][1]) % mod,
      ans %= mod;
  cout << ans;
  return 0;
}
