#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
const long long maxn = 7e2 + 10, maxm = 2e3 + 10, lg = 18, mod = 1e9 + 7,
                inf = 1e18;
long long dp[maxn][maxn][2], ans, po[maxn];
string s;
void add(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  po[0] = 1;
  for (int i = 1; i < maxn; i++) po[i] = 10 * po[i - 1] % mod;
  cin >> s;
  for (int d = 1; d <= 9; d++) {
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 0; i < (long long)(s.size()); i++)
      for (int j = 0; j <= i; j++) {
        add(dp[i + 1][j][1], dp[i][j][1] * d % mod);
        add(dp[i + 1][j + 1][1], dp[i][j][1] * (10 - d) % mod);
        add(dp[i + 1][j + ((s[i] - '0') >= d)][0], dp[i][j][0]);
        add(dp[i + 1][j][1], dp[i][j][0] * min(d, s[i] - '0') % mod);
        add(dp[i + 1][j + 1][1], dp[i][j][0] * max(0, s[i] - '0' - d) % mod);
      }
    for (int i = (long long)(s.size()); i; i--) {
      add(dp[(long long)(s.size())][i][1], dp[(long long)(s.size())][i + 1][1] +
                                               dp[(long long)(s.size())][i][0]);
      add(ans, po[i - 1] * dp[(long long)(s.size())][i][1] % mod);
    }
  }
  cout << ans << endl;
  return 0;
}
