Problem: Let S(n) denote the number that represents the digits of n in sorted order. For example, S(1) = 1, S(5) = 5, S(50394) = 3459, S(353535) = 333555.

Given a number X, compute <image> modulo 109 + 7.

Input

The first line of input will contain the integer X (1 ≤ X ≤ 10700).

Output

Print a single integer, the answer to the question.

Examples

Input

21


Output

195


Input

345342


Output

390548434

Note

The first few values of S are 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 12. The sum of these values is 195. 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  char c = getchar();
  long long tot = 1;
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') {
    tot = -1;
    c = getchar();
  }
  long long sum = 0;
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum * tot;
}
inline void wr(long long x) {
  if (x < 0) {
    putchar('-');
    wr(-x);
    return;
  }
  if (x >= 10) wr(x / 10);
  putchar(x % 10 + '0');
}
inline void wrn(long long x) {
  wr(x);
  putchar('\n');
}
inline void wri(long long x) {
  wr(x);
  putchar(' ');
}
inline void wrn(long long x, long long y) {
  wri(x);
  wrn(y);
}
inline void wrn(long long a, long long b, long long c) {
  wri(a);
  wrn(b, c);
}
long long n, m, f[701][701][10][2], ans;
char s[701];
inline void add(long long &x, long long k) {
  x += k;
  x -= (x >= 1000000007) ? 1000000007 : 0;
}
signed main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (long long i = (1); i <= (9); i++) f[0][0][i][0] = 1;
  for (long long i = (0); i <= (n - 1); i++)
    for (long long j = (0); j <= (i); j++)
      for (long long k = (1); k <= (9); k++)
        for (long long o = (0); o <= (1); o++)
          for (long long p = 0; p <= (o ? 9 : s[i + 1] - '0'); p++)
            add(f[i + 1][j + (p >= k)][k][o | (p < (s[i + 1] - '0'))],
                f[i][j][k][o]);
  for (long long k = (1); k <= (9); k++)
    for (long long i = 1, tmp = 1; i <= n;
         i++, tmp = (tmp * 10 + 1) % 1000000007)
      add(ans, tmp * (f[n][i][k][0] + f[n][i][k][1]) % 1000000007);
  wrn(ans);
  return 0;
}