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;
template <typename T>
T read1() {
  T t = 0;
  char k;
  bool vis = 0;
  do (k = getchar()) == '-' && (vis = 1);
  while ('0' > k || k > '9');
  while ('0' <= k && k <= '9')
    t = (t << 3) + (t << 1) + (k ^ '0'), k = getchar();
  return vis ? -t : t;
}
char str[705];
int s, h[10];
long long P[705][12], C[705][705];
int main() {
  scanf("%s", str + 1);
  s = strlen(str + 1);
  reverse(str + 1, str + s + 1);
  for (int i = 0; i < 12; ++i) P[0][i] = 1;
  for (int i = 1; i <= s; ++i)
    for (int j = 1; j < 12; ++j) P[i][j] = P[i - 1][j] * j % 1000000007;
  for (int i = 0; i <= s; ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; ++j)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % 1000000007;
  }
  long long ans = 0;
  for (int i = s; i; --i) {
    str[i] -= '0';
    long long k = 0;
    if (i != s) ++h[str[i + 1]];
    for (int j = 0; j < str[i]; ++j) {
      ++h[j];
      int o = 0;
      for (int l = 10; --l;) {
        o += h[l];
        for (int p = 0; p < i; ++p)
          k = (k + C[i - 1][p] * P[i - p - 1][l] % 1000000007 * P[p][10 - l] %
                       1000000007 * (P[o + p][10] - 1)) %
              1000000007;
        ans = (ans + 111111112ll * k) % 1000000007;
        k = 0;
      }
      --h[j];
    }
  }
  sort(str + 1, str + s + 1);
  long long sum = 0;
  for (int i = 1; i <= s; ++i) sum = (10ll * sum + str[i]) % 1000000007;
  cout << (ans + sum) % 1000000007;
  return 0;
}