#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
char s[1010];
int a[1010];
long long dp[707][707][2], dp1[707][707][2];
long long v[707];
int main() {
  long long ans = 0;
  int l;
  scanf("%s", s);
  l = strlen(s);
  for (int i = 0; i < l; i++) a[i] = s[i] - '0';
  v[0] = 1;
  for (int i = 1; i < l; i++) v[i] = (v[i - 1] * 10) % mod;
  for (int now = 1; now <= 9; now++) {
    memset(dp, 0, sizeof(dp));
    memset(dp1, 0, sizeof(dp1));
    dp[0][0][0] = 0;
    dp1[0][0][0] = 1;
    for (int i = 0; i <= l; i++)
      for (int j = 0; j <= i; j++) {
        if (i == l) continue;
        for (int k = 0; k <= 9; k++) {
          if (k < a[i]) {
            if (k < now)
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j][1] += dp[i][j][ii]) %= mod;
                (dp1[i + 1][j][1] += dp1[i][j][ii]) %= mod;
              }
            else if (k == now)
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j][1] +=
                 dp[i][j][ii] * 10 + v[j] * now % mod * dp1[i][j][ii]) %= mod;
                (dp1[i + 1][j][1] += dp1[i][j][ii]) %= mod;
              }
            else
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j + 1][1] += dp[i][j][ii] * 10) %= mod;
                (dp1[i + 1][j + 1][1] += dp1[i][j][ii]) %= mod;
              }
          } else if (k == a[i]) {
            if (k < now)
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j][ii] += dp[i][j][ii]) %= mod;
                (dp1[i + 1][j][ii] += dp1[i][j][ii]) %= mod;
              }
            else if (k == now)
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j][ii] +=
                 dp[i][j][ii] * 10 + v[j] * now % mod * dp1[i][j][ii]) %= mod;
                (dp1[i + 1][j][ii] += dp1[i][j][ii]) %= mod;
              }
            else
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j + 1][ii] += dp[i][j][ii] * 10) %= mod;
                (dp1[i + 1][j + 1][ii] += dp1[i][j][ii]) %= mod;
              }
          } else {
            if (k < now) {
              (dp[i + 1][j][1] += dp[i][j][1]) %= mod;
              (dp1[i + 1][j][1] += dp1[i][j][1]) %= mod;
            } else if (k == now) {
              (dp[i + 1][j][1] +=
               dp[i][j][1] * 10 + v[j] * now % mod * dp1[i][j][1]) %= mod;
              (dp1[i + 1][j][1] += dp1[i][j][1]) %= mod;
            } else {
              (dp[i + 1][j + 1][1] += dp[i][j][1] * 10) %= mod;
              (dp1[i + 1][j + 1][1] += dp1[i][j][1]) %= mod;
            }
          }
        }
      }
    for (int j = 0; j <= l; j++) (ans += dp[l][j][0] + dp[l][j][1]) %= mod;
  }
  printf("%I64d", ans);
  return 0;
}
