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>
struct {
  inline operator int() {
    int x;
    return scanf("%d", &x), x;
  }
  inline operator long long() {
    long long x;
    return scanf("%lld", &x), x;
  }
  template <class T>
  inline void operator()(T &x) {
    x = *this;
  }
  template <class T, class... A>
  inline void operator()(T &x, A &...a) {
    x = *this;
    this->operator()(a...);
  }
} read;
const int maxn = 707, mod = 1000000007;
char s[maxn];
int count[maxn][10];
long long f[maxn][maxn * 10];
long long a[maxn];
int main() {
  scanf("%s", s + 1);
  int n = int(strlen(s + 1));
  for (int i = 1; i <= n; i++) {
    for (int x = 0; x < 10; x++) count[i][x] = count[i - 1][x];
    ++count[i][s[i] - '0'];
  }
  for (int i = 1; i <= n; i++) a[i] = (a[i - 1] * 10 + 1) % mod;
  long long ans = 0;
  for (int X = 1; X <= 9; X++) {
    for (int i = 1; i <= n; i++) {
      int cnt = 0;
      for (int x = X; x < 10; x++) cnt += count[i - 1][x];
      f[i][0] = X * f[i - 1][0] % mod;
      for (int j = 1; j <= i * 10; j++)
        f[i][j] = ((10 - X) * f[i - 1][j - 1] + X * f[i - 1][j]) % mod;
      for (int x = 0; x < s[i] - '0'; x++) ++f[i][cnt + (x >= X)];
    }
    for (int j = 0; j <= n * 10; j++) (ans += f[n][j] * a[j]) %= mod;
  }
  for (int x = 1; x <= 9; x++) {
    int tot = 0;
    for (int i = 1; i <= n; i++) tot += s[i] - '0' >= x;
    ans += a[tot];
  }
  ans %= mod;
  printf("%lld\n", ans);
}