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;
char str[702];
int n, digit[702];
long long ret = 0;
long long C[702 + 1][702 + 1], my_pow[702][10 + 2];
void init() {
  for (int i = 0; i <= n; i++) C[i][0] = C[i][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < i; j++)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % 1000000007ll;
  }
  for (int j = 0; j <= 10; j++) {
    my_pow[0][j] = 1;
    for (int i = 1; i <= n; i++)
      my_pow[i][j] = (1ll * j * my_pow[i - 1][j]) % 1000000007ll;
  }
}
int total[10 + 2];
long long num_total[10 + 2][702];
long long solve(int prefix, int now) {
  long long ans = 0;
  for (int i = 0; i <= 10; i++) total[i] = 0;
  for (int i = 0; i <= prefix; i++) total[digit[i]]++;
  total[now]++;
  for (int i = 10 - 1; i >= 0; i--) total[i] += total[i + 1];
  for (int i = 0; i <= 10; i++) {
    for (int j = 0; j <= n; j++) {
      if (j < total[i])
        num_total[i][j] = 0;
      else if (j - total[i] > n - prefix - 2)
        num_total[i][j] = 0;
      else {
        int lena = 10 - i, lenb = i;
        int numa = j - total[i], numb = n - prefix - 2 - j + total[i];
        num_total[i][j] =
            (C[numa + numb][numa] *
             ((my_pow[numa][lena] * my_pow[numb][lenb]) % 1000000007ll)) %
            1000000007ll;
      }
    }
    for (int j = 1; j <= n; j++)
      num_total[i][j] = (num_total[i][j] + num_total[i][j - 1]) % 1000000007ll;
  }
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < n; j++) {
      long long num_count =
          (num_total[i + 1][j] - num_total[i][j] + 1000000007ll) % 1000000007ll;
      ans = (ans + ((num_count * 1ll * i) % 1000000007ll) * my_pow[j][10]) %
            1000000007ll;
    }
  }
  return ans;
}
int main() {
  scanf("%s", str), n = strlen(str);
  for (int i = 1; i <= n; i++) digit[i] = (int)(str[i - 1] - '0');
  init(), digit[n]++;
  for (int j = n; j >= 1; j--) {
    if (digit[j] > 9) digit[j] = 0, digit[j - 1]++;
  }
  if (digit[0])
    n++;
  else {
    for (int j = 0; j < n; j++) digit[j] = digit[j + 1];
  }
  for (int i = -1; i < n - 1; i++) {
    for (int j = 0; j < digit[i + 1]; j++)
      ret = (ret + solve(i, j)) % 1000000007ll;
  }
  printf("%lld\n", ret);
  return 0;
}