#include <bits/stdc++.h>
const int N = 705, mo = 1e9 + 7;
using namespace std;
inline int gi() {
  char ch = getchar();
  int x = 0, q = 0;
  while (ch < '0' || ch > '9') ch == '-' ? q = 1 : 0, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return q ? (-x) : x;
}
char s[N];
int f[N][N][2];
void dp(int &x, int y) {
  x += y;
  if (x >= mo) x -= mo;
  return;
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1), x, y, ans = 0;
  for (int i = 1; i <= 9; ++i) {
    f[0][0][1] = 1;
    for (int j = 0; j < n; ++j)
      for (int k = 0; k <= j; ++k)
        for (int l = 0; l <= 1; ++l)
          if (f[j][k][l])
            for (int p = 0; p <= 9; ++p) {
              if (l && p > s[j + 1] - '0') continue;
              if (p == s[j + 1] - '0')
                y = l;
              else
                y = 0;
              x = k + (p >= i);
              dp(f[j + 1][x][y], f[j][k][l]);
            }
    for (int j = 1, k = 1; j <= n; ++j, k = 1ll * k * 10 % mo + 1)
      dp(ans, 1ll * (f[n][j][0] + f[n][j][1]) * k % mo);
    for (int j = 0; j <= n; ++j)
      for (int k = 0; k <= j; ++k)
        for (int l = 0; l <= 2; ++l) f[j][k][l] = 0;
  }
  cout << ans;
  return 0;
}
