#include <bits/stdc++.h>
using namespace std;
const int maxn = 715;
const int mod = (1e9) + 7;
int n, m, i, j, t, k, s, one[maxn], a[maxn], c[15], su[15], yh[maxn][maxn],
    pw[15][maxn], ans;
char str[maxn];
void dfs(int x, bool y) {
  if (x == 0) {
    t = 0;
    for (int i = 9; i > 0; --i)
      ans = (ans + (one[t + c[i]] - one[t]) * 1ll * i) % mod, t += c[i];
    return;
  }
  if (!y) {
    for (int i = 9; i >= 0; --i) su[i] = su[i + 1] + c[i];
    for (int i = 1; i <= 9; ++i) {
      for (int j = 0; j <= x; ++j)
        ans = (ans + 1ll * one[j + su[i]] * yh[x][j] % mod * pw[10 - i][j] %
                         mod * pw[i][x - j]) %
              mod;
    }
    return;
  }
  for (int i = 0; i <= a[x]; ++i) {
    ++c[i];
    dfs(x - 1, i == a[x]);
    --c[i];
  }
}
int main() {
  one[0] = 0;
  for (i = 0; i <= 10; ++i) pw[i][0] = 1;
  for (i = 1; i < maxn; ++i) {
    one[i] = (one[i - 1] * 10ll + 1ll) % mod;
    for (j = 0; j <= 10; ++j) pw[j][i] = 1ll * j * pw[j][i - 1] % mod;
  }
  yh[0][0] = 1;
  for (i = 1; i < maxn; ++i) {
    yh[i][0] = yh[i][i] = 1;
    for (j = 1; j < i; ++j) yh[i][j] = (yh[i - 1][j - 1] + yh[i - 1][j]) % mod;
  }
  scanf("%s", str + 1);
  n = strlen(str + 1);
  reverse(str + 1, str + n + 1);
  for (i = 1; i <= n; ++i) a[i] = str[i] - '0';
  dfs(n, 1);
  ans = (ans % mod + mod) % mod;
  printf("%d\n", ans);
  return 0;
}
