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 = 1e9 + 7;
int D[2][710][11][710];
int E[2][710][11][710];
char ch[720];
int A[720], L;
long long ans;
long long pw[720];
inline void add(int &a, int b) { a = (a + b >= MOD ? a + b - MOD : a + b); }
void solve() {
  scanf("%s", ch + 1);
  L = (int)strlen(ch + 1);
  reverse(ch + 1, ch + 1 + L);
  for (int i = 1; i <= L; i++) {
    A[i] = ch[i] - '0';
  }
  pw[0] = 1;
  for (int i = 1; i < 720; i++) pw[i] = pw[i - 1] * 10 % MOD;
  for (int x = 0; x < 11; x++) D[0][0][x][0] = D[1][0][x][0] = 1;
  for (int i = 1; i <= L; i++) {
    for (int j = 10; j >= 0; j--) {
      for (int u = 0; u <= i; u++) {
        for (int x = 0; x < 10; x++) {
          int ni = i - 1;
          int nj = j;
          int nu = (u - (x >= j));
          if (nu >= 0) {
            add(D[0][i][j][u], D[0][ni][nj][nu]);
            if (x < A[i])
              add(D[1][i][j][u], D[0][ni][nj][nu]);
            else if (x == A[i])
              add(D[1][i][j][u], D[1][ni][nj][nu]);
          }
        }
      }
    }
  }
  for (int x = 0; x < 11; x++) E[1][L + 1][x][0] = 1;
  for (int i = L; i; i--) {
    for (int j = 9; j >= 0; j--) {
      for (int u = 0; u <= L + 1 - i; u++) {
        for (int x = 0; x < 10; x++) {
          int ni = i + 1;
          int nj = j;
          int nu = (u - (x >= j));
          if (nu >= 0) {
            if (x == A[i]) add(E[1][i][j][u], E[1][ni][nj][nu]);
            add(E[0][i][j][u], E[0][ni][nj][nu]);
            if (x < A[i]) add(E[0][i][j][u], E[1][ni][nj][nu]);
          }
        }
      }
    }
  }
  const long long LX = 7e18;
  for (int a = 0; a < 2; a++)
    for (int b = 0; b < L + 2; b++)
      for (int c = 0; c < 11; c++)
        for (int d = 0; d < L + 2; d++)
          E[a][b][c][d] = ((long long)E[a][b][c][d] * c % MOD * pw[d] % MOD);
  for (int a = 0; a < 2; a++)
    for (int b = 0; b < L + 2; b++)
      for (int c = 0; c < 11; c++)
        for (int d = 0; d < L + 2; d++)
          D[a][b][c][d] = (long long)D[a][b][c][d] * pw[d] % MOD;
  long long ans = 0;
  for (int i = 1; i <= L; i++) {
    for (int j = 1; j <= 9; j++) {
      for (int u = 0; u <= i - 1; u++)
        for (int v = 0; v <= L - i; v++) {
          long long val = 0;
          if (j < A[i])
            val = (E[0][i + 1][j][v] + E[1][i + 1][j][v]) *
                  (long long)D[0][i - 1][j + 1][u];
          else if (j == A[i])
            val = (E[0][i + 1][j][v] * (long long)D[0][i - 1][j + 1][u] +
                   (long long)E[1][i + 1][j][v] * D[1][i - 1][j + 1][u]);
          else
            val = ((long long)E[0][i + 1][j][v] * D[0][i - 1][j + 1][u]);
          ans += val;
          if (ans > LX) ans %= MOD;
        }
    }
  }
  printf("%lld\n", ans % MOD);
}
int main() {
  int Tc = 1;
  for (int tc = 1; tc <= Tc; tc++) {
    solve();
  }
  return 0;
}