#include <bits/stdc++.h>
using namespace std;
int f[705][705][2], p[705], a[705], n, ans;
int main() {
  register char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') a[++n] = ch - '0', ch = getchar();
  for (register int i = 1; i <= n; ++i)
    p[i] = (10LL * p[i - 1] + 1) % (1000000007);
  for (register int d = 0; d < 9; ++d) {
    memset(f, 0, sizeof(f)), f[0][0][1] = 1;
    for (register int i = 1; i <= n; ++i)
      for (register int j = 0; j <= i; ++j)
        for (register int k = 0; k < 2; ++k)
          for (register int p = 0; p < 10; ++p)
            if (!k || p <= a[i])
              (f[i][j + (p > d)][k && p == a[i]] += f[i - 1][j][k]) %=
                  (1000000007);
    for (register int j = 1; j <= n; ++j)
      ans = (1LL * p[j] * (f[n][j][0] + f[n][j][1]) + ans) % (1000000007);
  }
  cout << ans;
  return 0;
}
