#include <bits/stdc++.h>
const int mu = 1e9 + 7;
int dp[705][705][10][2], ans;
char s[705];
void reduce(int &x) { x += x >> 31 & mu; }
int main() {
  scanf("%s", s);
  int l = strlen(s);
  for (int i = 1; i <= 9; i++) dp[0][0][i][1] = 1;
  for (int i = 1; i <= l; i++)
    for (int j = 0; j < i; j++)
      for (int k = 1; k <= 9; k++)
        for (int h = 0; h <= 1; h++) {
          int t = dp[i - 1][j][k][h];
          if (!t) continue;
          for (int now = 0; now <= 9; now++) {
            if (h == 1 && now > s[i - 1] - '0') break;
            reduce(dp[i][j + (now >= k)][k][h & (now == s[i - 1] - '0')] +=
                   t - mu);
          }
        }
  for (int i = 1; i <= 9; i++) {
    for (int j = 1, t = 1; j <= l; j++, t = (t * 10ll + 1) % mu)
      ans = (ans + 1ll * t * (dp[l][j][i][0] + dp[l][j][i][1])) % mu;
  }
  printf("%d\n", ans);
}
