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 long long mod = 1e9 + 7;
char str[1010];
long long n, ans, s[1010], slen, elevs[1010], dp[1010][10][1010],
    sum[1010][1010], cnt[1010];
void pre(long long x) {
  for (long long i = 0; i < 10; ++i) {
    for (long long j = 0; j <= slen; ++j) {
      for (long long k = 0; k <= slen; ++k) dp[j][i][k] = 0;
    }
  }
  for (long long j = 0; j <= slen; ++j) {
    for (long long k = 0; k <= slen; ++k) sum[j][k] = 0;
  }
  for (long long i = 0; i < 10; ++i) dp[1][i][i >= x ? 1 : 0] = 1;
  for (long long j = 0; j <= slen; ++j) {
    for (long long k = 0; k < 10; ++k)
      sum[1][j] = (sum[1][j] + dp[1][k][j]) % mod;
  }
  for (long long i = 1; i < slen; ++i) {
    for (long long j = 0; j < 10; ++j) {
      if (j >= x) {
        for (long long k = 1; k <= slen; ++k)
          dp[i + 1][j][k] = (dp[i + 1][j][k] + sum[i][k - 1]) % mod;
      } else {
        for (long long k = 0; k <= slen; ++k)
          dp[i + 1][j][k] = (dp[i + 1][j][k] + sum[i][k]) % mod;
      }
    }
    for (long long j = 0; j <= slen; ++j) {
      for (long long k = 0; k < 10; ++k)
        sum[i + 1][j] = (sum[i + 1][j] + dp[i + 1][k][j]) % mod;
    }
  }
}
void solve(long long x) {
  long long now = 0;
  for (long long i = 1, rest = slen; i <= slen; ++i, --rest) {
    for (long long j = 0; j < s[i]; ++j) {
      for (long long k = 0; k <= rest; ++k)
        cnt[k + now] = (cnt[k + now] + dp[rest][j][k]) % mod;
    }
    now += (s[i] >= x ? 1 : 0);
  }
  ++cnt[now];
}
int main() {
  scanf("%s", str);
  slen = strlen(str);
  for (long long i = 1; i <= slen; ++i) s[i] = str[i - 1] - '0';
  elevs[0] = 0;
  for (long long i = 1; i <= slen; ++i)
    elevs[i] = (elevs[i - 1] * 10 + 1) % mod;
  for (long long i = 1; i <= 9; ++i) {
    pre(i);
    solve(i);
  }
  for (long long i = 0; i <= slen; ++i) ans = (ans + elevs[i] * cnt[i]) % mod;
  printf("%lld\n", ans);
  return 0;
}