#include <bits/stdc++.h>
using namespace std;
inline int readint() {
  int a = 0;
  char c = getchar(), f = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -f;
  for (; '0' <= c && c <= '9'; c = getchar())
    a = (a << 3) + (a << 1) + (c ^ 48);
  return a * f;
}
const int Mod = 1e9 + 7;
const int MaxN = 705;
int f[MaxN][2], g[MaxN][2];
int num[MaxN], n;
int solve(int d) {
  memset(g, 0, (n + 1) * 2 << 2);
  memset(f, 0, (n + 1) * 2 << 2);
  g[0][0] = 1;
  long long v;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 10; ++j)
      for (int p = j > num[i]; p < 2; ++p) {
        v = g[i - 1][p] * ((j > d) ? 10ll : 1);
        g[i][p | (j < num[i])] = (v + g[i][p | (j < num[i])]) % Mod;
        v = f[i - 1][p] * ((j >= d) ? 10ll : 1);
        if (j == d) v += 1ll * g[i - 1][p] * d;
        f[i][p | (j < num[i])] = (v + f[i][p | (j < num[i])]) % Mod;
      }
  return f[n][1];
}
char str[MaxN];
int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  for (int i = 1; i <= n; ++i) num[i] = str[i] - '0';
  ++num[n];
  int ans = 0;
  for (int i = 1; i <= 9; ++i) ans = (ans + solve(i)) % Mod;
  printf("%d\n", ans);
  return 0;
}
