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 TP>
inline bool rd(TP& r) {
  r = 0;
  char tmp = getchar();
  while (tmp < '0' || tmp > '9') {
    if (tmp == EOF) return 0;
    tmp = getchar();
  }
  while ('0' <= tmp && tmp <= '9') {
    r = (r << 3) + (r << 1) + tmp - '0';
    tmp = getchar();
  }
  return 1;
}
long long P = 1000000007;
long long power(long long ori, long long t) {
  long long re = 1;
  while (t) {
    if (t & 1) re = re * ori % P;
    ori = ori * ori % P;
    t >>= 1;
  }
  return re;
}
char in[800];
int bits;
int x[800];
long long n[12][800], k[12][800];
long long f[2][800][2];
void dp(int b) {
  memset(f, 0, sizeof(f));
  f[0][0][1] = 1;
  for (int i = 1; i <= bits; - ++i) {
    memset(f[(i & 1)], 0, sizeof(f[(i & 1)]));
    for (int j = 0; j <= bits; ++j) {
      if (x[i] < b)
        f[(i & 1)][j][1] = (f[(i & 1)][j][1] + f[((i + 1) & 1)][j][1]) % P;
      else if (x[i] >= b && j - 1 >= 0)
        f[(i & 1)][j][1] = (f[(i & 1)][j][1] + f[((i + 1) & 1)][j - 1][1]) % P;
      for (int now = 0; now <= 9; ++now) {
        if (now < b)
          f[(i & 1)][j][0] = (f[(i & 1)][j][0] + f[((i + 1) & 1)][j][0]) % P;
        else if (now >= b && j - 1 >= 0)
          f[(i & 1)][j][0] =
              (f[(i & 1)][j][0] + f[((i + 1) & 1)][j - 1][0]) % P;
        if (now < x[i]) {
          if (now < b)
            f[(i & 1)][j][0] = (f[(i & 1)][j][0] + f[((i + 1) & 1)][j][1]) % P;
          else if (now >= b && j - 1 >= 0)
            f[(i & 1)][j][0] =
                (f[(i & 1)][j][0] + f[((i + 1) & 1)][j - 1][1]) % P;
        }
      }
    }
  }
  for (int i = 1; i <= bits; ++i)
    for (int j = i; j <= bits; ++j)
      k[b][i] = (k[b][i] + f[bits & 1][j][0] + f[bits & 1][j][1]) % P;
}
void work() {
  for (int b = 1; b <= 9; ++b)
    for (int i = 1; i <= bits; ++i) n[b][i] = (k[b][i] - k[b + 1][i] + P) % P;
}
long long ans;
int main() {
  cin >> in + 1;
  bits = strlen(in + 1);
  for (int i = 1; i <= bits; ++i) x[i] = in[i] - '0';
  for (int b = 1; b <= 9; ++b) {
    dp(b);
  }
  work();
  for (int i = 1; i <= bits; ++i) {
    for (int b = 1; b <= 9; ++b)
      ans = (ans + b * power(10, i - 1) % P * n[b][i] % P) % P;
  }
  cout << ans << endl;
  return 0;
}