#include <bits/stdc++.h>
using namespace std;
const int p = 1e9 + 7;
int n;
char s[706];
int f[706][10][706][2];
inline void add(int &x, int y) {
  x += y;
  if (x >= p) x -= p;
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = 1; i <= 9; i++) f[0][i][0][1] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= 9; j++) {
      for (int k = 0; k < n; k++) {
        for (int l = 0; l <= 9; l++) {
          add(f[i + 1][j][k + (l >= j)][0], f[i][j][k][0]);
          if (l <= s[i + 1] - '0')
            add(f[i + 1][j][k + (l >= j)][l == s[i + 1] - '0'], f[i][j][k][1]);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1, x = 1; i <= n; i++, x = (1ll * x * 10 + 1) % p) {
    for (int j = 1; j <= 9; j++) {
      add(ans, 1ll * x * (f[n][j][i][0] + f[n][j][i][1]) % p);
    }
  }
  printf("%d", ans);
}
