#include <bits/stdc++.h>
const int maxn = 1e5 + 10, mod = 1e9 + 7;
int n, m, k, t, num[710], tot;
using namespace std;
char a[710];
long long dp[710][710][10];
long long dfs(int pos, int need, int dig, int limit, int zero) {
  if (pos < 0) return !need;
  if (limit && zero && dp[pos][need][dig] != -1) return dp[pos][need][dig];
  long long ret = 0;
  for (int i = 0; i <= (limit ? 9 : num[pos]); i++) {
    ret = (ret + dfs(pos - 1, max(0, need - (i >= dig)), dig,
                     limit || i < num[pos], zero || i)) %
          mod;
  }
  return limit && zero ? dp[pos][need][dig] = ret : ret;
}
int main() {
  int i, j;
  memset(dp, -1, sizeof(dp));
  scanf("%s", a);
  tot = strlen(a);
  for (i = 0; i < tot; i++) {
    num[tot - 1 - i] = a[i] - '0';
  }
  long long ret = 0, pw = 1;
  for (i = 1; i <= tot; i++) {
    for (j = 1; j < 10; j++) {
      ret = (ret + pw * dfs(tot - 1, i, j, 0, 0) % mod) % mod;
    }
    pw = pw * 10 % mod;
  }
  printf("%lld\n", ret);
  return 0;
}
