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;
const int mod = 1000000007;
char s[1010];
int a[1010];
long long dp[707][707][2], dp1[707][707][2];
long long v[707];
int main() {
  long long ans = 0;
  int l;
  scanf("%s", s);
  l = strlen(s);
  for (int i = 0; i < l; i++) a[i] = s[i] - '0';
  v[0] = 1;
  for (int i = 1; i < l; i++) v[i] = (v[i - 1] * 10) % mod;
  for (int now = 1; now <= 9; now++) {
    memset(dp, 0, sizeof(dp));
    memset(dp1, 0, sizeof(dp1));
    dp[0][0][0] = 0;
    dp1[0][0][0] = 1;
    for (int i = 0; i <= l; i++)
      for (int j = 0; j <= i; j++) {
        if (i == l) continue;
        for (int k = 0; k <= 9; k++) {
          if (k < a[i]) {
            if (k < now)
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j][1] += dp[i][j][ii]) %= mod;
                (dp1[i + 1][j][1] += dp1[i][j][ii]) %= mod;
              }
            else if (k == now)
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j][1] +=
                 dp[i][j][ii] * 10 + v[j] * now % mod * dp1[i][j][ii]) %= mod;
                (dp1[i + 1][j][1] += dp1[i][j][ii]) %= mod;
              }
            else
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j + 1][1] += dp[i][j][ii] * 10) %= mod;
                (dp1[i + 1][j + 1][1] += dp1[i][j][ii]) %= mod;
              }
          } else if (k == a[i]) {
            if (k < now)
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j][ii] += dp[i][j][ii]) %= mod;
                (dp1[i + 1][j][ii] += dp1[i][j][ii]) %= mod;
              }
            else if (k == now)
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j][ii] +=
                 dp[i][j][ii] * 10 + v[j] * now % mod * dp1[i][j][ii]) %= mod;
                (dp1[i + 1][j][ii] += dp1[i][j][ii]) %= mod;
              }
            else
              for (int ii = 0; ii < 2; ii++) {
                (dp[i + 1][j + 1][ii] += dp[i][j][ii] * 10) %= mod;
                (dp1[i + 1][j + 1][ii] += dp1[i][j][ii]) %= mod;
              }
          } else {
            if (k < now) {
              (dp[i + 1][j][1] += dp[i][j][1]) %= mod;
              (dp1[i + 1][j][1] += dp1[i][j][1]) %= mod;
            } else if (k == now) {
              (dp[i + 1][j][1] +=
               dp[i][j][1] * 10 + v[j] * now % mod * dp1[i][j][1]) %= mod;
              (dp1[i + 1][j][1] += dp1[i][j][1]) %= mod;
            } else {
              (dp[i + 1][j + 1][1] += dp[i][j][1] * 10) %= mod;
              (dp1[i + 1][j + 1][1] += dp1[i][j][1]) %= mod;
            }
          }
        }
      }
    for (int j = 0; j <= l; j++) (ans += dp[l][j][0] + dp[l][j][1]) %= mod;
  }
  printf("%I64d", ans);
  return 0;
}