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;
long long power(long long x, long long y, long long mod) {
  if (y < 0) return power(power(x, mod - 2, mod), -y, mod);
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    y >>= 1;
    x = x * x % mod;
  }
  return res;
}
const int mod = 1e9 + 7;
const int nn = 710;
char str[nn];
int f[nn][nn], C[nn][nn], p[10][nn];
int a[nn], po[nn][nn], sb[10], b[10];
int res, n;
void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
void doit(int n) {
  sb[0] = b[0];
  for (int i = (int)1; i <= (int)9; ++i) sb[i] = sb[i - 1] + b[i];
  for (int x = 1; x <= 9; ++x) {
    for (int i = 0; i <= n; ++i) {
      add(res, (long long)C[n][i] * p[x][i + b[x]] % mod *
                   po[10][sb[9] - sb[x]] % mod * po[90 - 9 * x][n - i] % mod);
    }
  }
}
int main() {
  cin >> str + 1;
  n = strlen(str + 1);
  for (int i = 0; i <= n; ++i) {
    for (int j = (int)0; j <= (int)700; ++j) po[j][i] = power(j, i, mod);
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; ++j) {
      C[i][j] = C[i - 1][j];
      add(C[i][j], C[i - 1][j - 1]);
    }
  }
  for (int i = 1; i < 10; ++i)
    for (int j = 1; j <= n; ++j)
      p[i][j] = ((long long)p[i][j - 1] * 10 % mod + i) % mod;
  for (int i = 1; i <= n; ++i) {
    a[i] = str[i] - '0';
    for (int j = 0; j < a[i]; ++j) {
      for (int k = 0; k < 10; ++k) b[k] = 0;
      b[j] = 1;
      for (int k = 1; k < i; ++k) b[a[k]]++;
      doit(n - i);
    }
  }
  for (int k = 0; k < 10; ++k) b[k] = 0;
  for (int k = 1; k <= n; ++k) b[a[k]]++;
  doit(0);
  cout << res << endl;
  return 0;
}