#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long res = 0;
  char c;
  bool zf = 0;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    zf = 1;
  else
    res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9')
    res = (res << 3) + (res << 1) + c - '0';
  if (zf) return -res;
  return res;
}
long long data[701];
long long dp[701][701][10][2];
inline void add(long long &x, long long y) {
  x += y;
  if (x > 1000000007) x -= 1000000007;
  return;
}
signed main() {
  string s;
  cin >> s;
  s = ' ' + s;
  long long n = s.size() - 1;
  for (register long long i = 1; i <= n; i++) {
    data[i] = s[i] - '0';
  }
  for (register long long i = 1; i <= 9; i++) {
    dp[0][0][i][1] = 1;
  }
  for (register long long i = 0; i < n; i++)
    for (register long long j = 0; j <= i; j++)
      for (register long long k = 1; k <= 9; k++)
        for (register long long l = 0; l <= 1; l++)
          for (register long long m = 0; m <= (l ? data[i + 1] : 9); m++)
            add(dp[i + 1][j + (m >= k)][k][l & (m == data[i + 1])],
                dp[i][j][k][l]);
  long long ans = 0;
  for (register long long i = 1; i <= 9; i++) {
    long long tmp = 1;
    for (register long long j = 1; j <= n; j++) {
      add(ans, 1ll * tmp * (dp[n][j][i][0] + dp[n][j][i][1]) % 1000000007);
      tmp = (tmp * 10 + 1) % 1000000007;
    }
  }
  cout << ans << '\n';
  return 0;
}
