#include <bits/stdc++.h>
using namespace std;
int n, ans, num, a[710], dp[710][710][2][2], md = 1000000007;
char s[1010];
int power(int x, int p) {
  int num = 1;
  while (p) {
    if (p & 1) num = (long long)num * x % md;
    x = (long long)x * x % md;
    p >>= 1;
  }
  return num;
}
int dfs(int pos, int cnt, int x, int vis, int flg) {
  if (!pos) return vis && !cnt;
  if (dp[pos][cnt][vis][flg] != -1) return dp[pos][cnt][vis][flg];
  int mx = flg ? a[pos] : 9, sum = 0;
  for (int i = 0; i <= mx; ++i)
    if (i < num)
      sum = (sum + dfs(pos - 1, cnt, x, vis, flg && i == mx)) % md;
    else if (i > num) {
      if (cnt) sum = (sum + dfs(pos - 1, cnt - 1, x, vis, flg && i == mx)) % md;
    } else if (vis)
      sum = (sum + dfs(pos - 1, cnt, x, 1, flg && i == mx)) % md;
    else {
      if (cnt) sum = (sum + dfs(pos - 1, cnt - 1, x, 0, flg && i == mx)) % md;
      sum = (sum + dfs(pos - 1, cnt, x, 1, flg && i == mx)) % md;
    }
  dp[pos][cnt][vis][flg] = sum;
  return sum;
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 1; i <= n; ++i) a[i] = s[n - i] - '0';
  for (int i = 1; i <= 9; ++i) {
    memset(dp, -1, sizeof(dp));
    num = i;
    for (int j = 0; j < n; ++j)
      ans = (ans + (long long)i * power(10, j) % md * dfs(n, j, i, 0, 1) % md) %
            md;
  }
  printf("%d\n", ans);
  return 0;
}
