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 c[800];
long long _10[800];
long long dp[800][800][10][2];
int main() {
  long long modu = 1000000007;
  int n, i, j, k, l, x, bd;
  scanf("%s", c);
  n = strlen(c);
  for (i = 0; i < n; i++)
    for (j = 0; j <= n; j++)
      for (k = 0; k <= 9; k++)
        for (l = 0; l <= 1; l++) dp[i][j][k][l] = 0;
  x = c[0] - '0';
  for (k = 0; k <= 9; k++) {
    if (x < k) {
      dp[0][0][k][0] = 1;
      dp[0][0][k][1] = x;
    } else {
      dp[0][0][k][1] = k;
      dp[0][1][k][0] = 1;
      dp[0][1][k][1] = x - k;
    }
  }
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j <= n; j++) {
      for (k = 0; k <= 9; k++) {
        x = c[i + 1] - '0';
        dp[i + 1][j + 1][k][1] += dp[i][j][k][1] * (10 - k);
        dp[i + 1][j][k][1] += dp[i][j][k][1] * k;
        dp[i + 1][j + 1][k][1] %= modu;
        dp[i + 1][j][k][1] %= modu;
        if (x < k) {
          dp[i + 1][j][k][0] += dp[i][j][k][0];
          dp[i + 1][j][k][1] += dp[i][j][k][0] * x;
          dp[i + 1][j][k][0] %= modu;
          dp[i + 1][j][k][1] %= modu;
        } else {
          dp[i + 1][j + 1][k][0] += dp[i][j][k][0];
          dp[i + 1][j + 1][k][1] += dp[i][j][k][0] * (x - k);
          dp[i + 1][j][k][1] += dp[i][j][k][0] * k;
          dp[i + 1][j + 1][k][0] %= modu;
          dp[i + 1][j + 1][k][1] %= modu;
          dp[i + 1][j][k][1] %= modu;
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (i == 0)
      _10[0] = 1;
    else
      _10[i] = _10[i - 1] * 10 % modu;
  }
  long long sum = 0;
  for (j = n - 1; j >= 0; j--) {
    for (i = 0; i < n; i++) {
      for (k = 0; k <= 9; k++) {
        for (l = 0; l <= 1; l++) {
          dp[i][j][k][l] += dp[i][j + 1][k][l];
          dp[i][j][k][l] %= modu;
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    for (k = 0; k <= 9; k++) {
      long long tmp =
          dp[n - 1][n - i][k][0] + dp[n - 1][n - i][k][1] -
          (k == 9 ? 0
                  : dp[n - 1][n - i][k + 1][0] + dp[n - 1][n - i][k + 1][1]);
      tmp = (tmp % modu + modu) % modu;
      sum += tmp * k % modu * _10[n - i - 1] % modu;
      sum %= modu;
    }
  }
  printf("%lld\n", sum);
  return 0;
}