#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  char c = getchar();
  long long tot = 1;
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') {
    tot = -1;
    c = getchar();
  }
  long long sum = 0;
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum * tot;
}
inline void wr(long long x) {
  if (x < 0) {
    putchar('-');
    wr(-x);
    return;
  }
  if (x >= 10) wr(x / 10);
  putchar(x % 10 + '0');
}
inline void wrn(long long x) {
  wr(x);
  putchar('\n');
}
inline void wri(long long x) {
  wr(x);
  putchar(' ');
}
inline void wrn(long long x, long long y) {
  wri(x);
  wrn(y);
}
inline void wrn(long long a, long long b, long long c) {
  wri(a);
  wrn(b, c);
}
long long n, m, f[701][701][10][2], ans;
char s[701];
inline void add(long long &x, long long k) {
  x += k;
  x -= (x >= 1000000007) ? 1000000007 : 0;
}
signed main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (long long i = (1); i <= (9); i++) f[0][0][i][0] = 1;
  for (long long i = (0); i <= (n - 1); i++)
    for (long long j = (0); j <= (i); j++)
      for (long long k = (1); k <= (9); k++)
        for (long long o = (0); o <= (1); o++)
          for (long long p = 0; p <= (o ? 9 : s[i + 1] - '0'); p++)
            add(f[i + 1][j + (p >= k)][k][o | (p < (s[i + 1] - '0'))],
                f[i][j][k][o]);
  for (long long k = (1); k <= (9); k++)
    for (long long i = 1, tmp = 1; i <= n;
         i++, tmp = (tmp * 10 + 1) % 1000000007)
      add(ans, tmp * (f[n][i][k][0] + f[n][i][k][1]) % 1000000007);
  wrn(ans);
  return 0;
}
