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 kN = 710;
const long long MD = 1000000007;
char s[kN];
int n;
long long ans[kN], b[kN], Ans;
inline long long pwer(long long a, long long b, long long ret = 1ll) {
  for (; b; b >>= 1, a = a * a % MD)
    if (b & 1) ret = ret * a % MD;
  return ret;
}
namespace JC {
long long jc[kN], jc_inv[kN];
long long inv[11] = {0,         1,         500000004, 333333336,
                     250000002, 400000003, 166666668, 142857144,
                     125000001, 111111112, 700000005};
inline void init() {
  jc[0] = 1ll;
  for (long long i = 1; i <= n; i++) jc[i] = jc[i - 1] * i % MD;
  jc_inv[n] = pwer(jc[n], MD - 2);
  for (long long i = n - 1; i >= 0; i--)
    jc_inv[i] = jc_inv[i + 1] * (i + 1) % MD;
}
inline long long C(long long n, long long m) {
  return jc[n] * jc_inv[m] % MD * jc_inv[n - m] % MD;
}
}  // namespace JC
using JC::C;
void dp(int d) {
  int las = 0;
  for (int i = 0; i < n; i++) {
    int lower = (i == 0);
    long long tim1 = 0, tim2 = 0;
    if (s[i] <= d)
      tim1 = s[i] - lower, tim2 = 0;
    else
      tim1 = d - lower, tim2 = s[i] - d;
    long long m = n - 1 - i;
    long long pw1 = 1ll, pw2 = pwer(d, m);
    for (int k = 0; k <= m; k++) {
      long long t = C(m, k) * pw1 % MD * pw2 % MD;
      ans[las + k] = (ans[las + k] + tim1 * t) % MD;
      ans[las + 1 + k] = (ans[las + 1 + k] + tim2 * t) % MD;
      pw1 = pw1 * (9 - d + 1) % MD;
      pw2 = pw2 * JC::inv[d] % MD;
    }
    las += (s[i] >= d);
  }
  ans[las] = (ans[las] + 1) % MD;
  for (int i = n - 1; i >= 1; i--) {
    long long m = i - 1;
    long long pw1 = 1ll, pw2 = pwer(d, m);
    for (int k = 0; k <= m; k++) {
      long long t = C(m, k) * pw1 % MD * pw2 % MD;
      ans[k] = (ans[k] + (d - 1) * t) % MD;
      ans[1 + k] = (ans[1 + k] + (9 - d + 1) * t) % MD;
      pw1 = pw1 * (9 - d + 1) % MD;
      pw2 = pw2 * JC::inv[d] % MD;
    }
  }
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; i++) s[i] -= '0';
  for (int i = 1; i <= n; i++) b[i] = (b[i - 1] * 10ll + 1ll) % MD;
  JC::init();
  for (int i = 1; i <= 9; i++) {
    memset(ans, 0, sizeof(long long) * (n + 5));
    dp(i);
    for (int j = 1; j <= n; j++) Ans = (Ans + ans[j] * b[j]) % MD;
  }
  cout << Ans << endl;
}