#include <bits/stdc++.h>
using namespace std;
char n[710];
int nn;
long long mod = 1e9 + 7, dp[710][710][10];
long long dfs(int len, int sy, int d, bool kk) {
  if (len == nn) return 1;
  if (!kk && dp[len][sy][d] != -1) return dp[len][sy][d];
  int ma = kk ? n[len] - '0' : 9;
  long long ans = 0;
  for (int i = 0; i <= ma; i++) {
    if (i > d) {
      if (sy) ans = (ans + dfs(len + 1, sy - 1, d, kk && ma == i)) % mod;
    } else
      ans = (ans + dfs(len + 1, sy, d, kk && ma == i)) % mod;
  }
  if (!kk) dp[len][sy][d] = ans;
  return ans;
}
int main() {
  scanf("%s", n);
  nn = strlen(n);
  long long now = 1, ans = 0;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < nn; i++) {
    long long pre = 0;
    for (int d = 0; d < 10; d++) {
      long long an = dfs(0, i, d, 1);
      ans = (ans + d * now % mod * (an - pre)) % mod;
      pre = an;
    }
    now = now * 10 % mod;
  }
  return printf("%lld", (ans + mod) % mod), 0;
}
