#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
int const N = 700 + 20, C = 10, mod = 1e9 + 7;
int n, cnt[C], ans;
string s;
inline void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}
int pw[C][N], save[N], comb[N][N];
void pre() {
  for (int i = 0; i < C; i++) {
    pw[i][0] = 1;
    for (int j = 1; j < N; j++) pw[i][j] = 1ll * pw[i][j - 1] * i % mod;
  }
  save[0] = 0;
  for (int i = 1; i < N; i++) save[i] = (10ll * save[i - 1] + 1) % mod;
  for (int i = 0; i < N; i++) {
    comb[i][0] = comb[i][i] = 1;
    for (int j = 1; j < i; j++)
      comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % mod;
  }
}
inline int func(int n, int m) {
  int ans = 0;
  int sum = 0;
  for (int d = 9; d; d--) {
    sum += cnt[d];
    for (int x = 0; x <= n; x++) {
      add(ans, 1ll * save[x + sum] * pw[10 - d][x] % mod * pw[d][n - x] % mod *
                   comb[n][x] % mod);
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  pre();
  cin >> s;
  n = (int)s.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s[i] - '0'; j++) {
      cnt[j]++;
      add(ans, func(n - i - 1, n));
      cnt[j]--;
    }
    cnt[s[i] - '0']++;
  }
  add(ans, func(0, n));
  cout << ans << '\n';
}
