#include <bits/stdc++.h>
using namespace std;
char s[705];
int d[705], dp[705][705][10];
void fmod(int& x) { x -= 1000000007, x += x >> 31 & 1000000007; }
int dfs(int pos, int limit, int sum, int low) {
  if (!pos) return !sum;
  if (!limit && ~dp[pos][sum][low]) return dp[pos][sum][low];
  int res = 0, up = limit ? d[pos] : 9;
  for (int i = 0; i <= up; ++i)
    fmod(res += dfs(pos - 1, limit && i == up, sum - (i >= low), low));
  if (!limit) dp[pos][sum][low] = res;
  return res;
}
int solve(char* s) {
  int res = 0;
  d[0] = 0;
  int n = strlen(s + 1);
  for (int i = 1, j = n; i <= n; ++i, --j) d[j] = s[i] - '0';
  for (int i = 1; i <= 9; ++i)
    for (int j = 1, now = 1; j <= n; ++j, now = (10ll * now + 1) % 1000000007)
      fmod(res += 1ll * dfs(n, 1, j, i) * now % 1000000007);
  return res;
}
signed main() {
  memset(dp, -1, sizeof(dp));
  scanf("%s", s + 1);
  printf("%d\n", solve(s));
}
