#include <bits/stdc++.h>
using namespace std;
char c[800];
long long _10[800];
long long dp[800][800][10][2];
int main() {
  long long modu = 1000000007;
  int n, i, j, k, l, x, bd;
  scanf("%s", c);
  n = strlen(c);
  for (i = 0; i < n; i++)
    for (j = 0; j <= n; j++)
      for (k = 0; k <= 9; k++)
        for (l = 0; l <= 1; l++) dp[i][j][k][l] = 0;
  x = c[0] - '0';
  for (k = 0; k <= 9; k++) {
    if (x < k) {
      dp[0][0][k][0] = 1;
      dp[0][0][k][1] = x;
    } else {
      dp[0][0][k][1] = k;
      dp[0][1][k][0] = 1;
      dp[0][1][k][1] = x - k;
    }
  }
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j <= n; j++) {
      for (k = 0; k <= 9; k++) {
        x = c[i + 1] - '0';
        dp[i + 1][j + 1][k][1] += dp[i][j][k][1] * (10 - k);
        dp[i + 1][j][k][1] += dp[i][j][k][1] * k;
        dp[i + 1][j + 1][k][1] %= modu;
        dp[i + 1][j][k][1] %= modu;
        if (x < k) {
          dp[i + 1][j][k][0] += dp[i][j][k][0];
          dp[i + 1][j][k][1] += dp[i][j][k][0] * x;
          dp[i + 1][j][k][0] %= modu;
          dp[i + 1][j][k][1] %= modu;
        } else {
          dp[i + 1][j + 1][k][0] += dp[i][j][k][0];
          dp[i + 1][j + 1][k][1] += dp[i][j][k][0] * (x - k);
          dp[i + 1][j][k][1] += dp[i][j][k][0] * k;
          dp[i + 1][j + 1][k][0] %= modu;
          dp[i + 1][j + 1][k][1] %= modu;
          dp[i + 1][j][k][1] %= modu;
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (i == 0)
      _10[0] = 1;
    else
      _10[i] = _10[i - 1] * 10 % modu;
  }
  long long sum = 0;
  for (j = n - 1; j >= 0; j--) {
    for (i = 0; i < n; i++) {
      for (k = 0; k <= 9; k++) {
        for (l = 0; l <= 1; l++) {
          dp[i][j][k][l] += dp[i][j + 1][k][l];
          dp[i][j][k][l] %= modu;
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    for (k = 0; k <= 9; k++) {
      long long tmp =
          dp[n - 1][n - i][k][0] + dp[n - 1][n - i][k][1] -
          (k == 9 ? 0
                  : dp[n - 1][n - i][k + 1][0] + dp[n - 1][n - i][k + 1][1]);
      tmp = (tmp % modu + modu) % modu;
      sum += tmp * k % modu * _10[n - i - 1] % modu;
      sum %= modu;
    }
  }
  printf("%lld\n", sum);
  return 0;
}
