#include <bits/stdc++.h>
using namespace std;
const int N = 700 + 5;
template <typename T>
bool cmax(T &a, T b) {
  return (a < b) ? a = b, 1 : 0;
}
template <typename T>
bool cmin(T &a, T b) {
  return (a > b) ? a = b, 1 : 0;
}
template <typename T>
T read() {
  T ans = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (isdigit(ch))
    ans = (ans << 3) + (ans << 1) + (ch - '0'), ch = getchar();
  return ans * f;
}
template <typename T>
void write(T x, char y) {
  if (x == 0) {
    putchar('0'), putchar(y);
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  static char wr[20];
  int top = 0;
  for (; x; x /= 10) wr[++top] = x % 10 + '0';
  while (top) putchar(wr[top--]);
  putchar(y);
}
void file() {}
int dp[N][N][10][2], n;
char s[N];
void input() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
}
const int mo = 1e9 + 7;
int mc[N];
void add(int &x, int y) {
  x += y;
  x -= (x >= mo ? mo : 0);
}
void work() {
  int limit;
  mc[1] = 1;
  for (register int i = (int)(2); i <= (int)(n); ++i)
    mc[i] = 1ll * ((long long)mc[i - 1] * 10 + 1) % mo;
  for (register int i = (int)(0); i <= (int)(9); ++i) dp[0][0][i][1] = 1;
  for (register int i = (int)(0); i <= (int)(n - 1); ++i)
    for (register int j = (int)(0); j <= (int)(i); ++j)
      for (register int k = (int)(0); k <= (int)(9); ++k)
        for (register int o = (int)(0); o <= (int)(1); ++o)
          if (dp[i][j][k][o]) {
            limit = o ? s[i + 1] - '0' : 9;
            for (register int now = (int)(0); now <= (int)(limit); ++now) {
              add(dp[i + 1][j + (now >= k)][k][o & (now == limit)],
                  dp[i][j][k][o]);
            }
          }
  int ans = 0;
  for (register int i = (int)(1); i <= (int)(n); ++i)
    for (register int k = (int)(1); k <= (int)(9); ++k)
      add(ans, 1ll * mc[i] * (dp[n][i][k][0] + dp[n][i][k][1]) % mo);
  write(ans, '\n');
}
int main() {
  file();
  input();
  work();
  reverse(s + 1, s + n + 1);
  return 0;
}
