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 gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXLEN = 701;
const int MOD = 1000000007;
const int INV9 = 111111112;
char s[MAXLEN + 1];
int n;
int ones[MAXLEN + 1];
int dp[MAXLEN + 1][MAXLEN + 1][2];
void inc(int &a, long long b) { a = (a + b) % MOD; }
void run() {
  scanf("%s", s);
  n = strlen(s);
  ones[0] = 0;
  for (int i = (1); i <= (n); ++i)
    ones[i] = ((long long)10 * ones[i - 1] + 1) % MOD;
  int ret = 0;
  for (int k = (1); k <= (9); ++k) {
    memset(dp, 0, sizeof(dp));
    dp[0][0][1] = 1;
    for (int i = (0); i < (n); ++i)
      for (int j = (0); j <= (i); ++j) {
        inc(dp[i + 1][j][0], (long long)k * dp[i][j][0]);
        inc(dp[i + 1][j + 1][0], (long long)(10 - k) * dp[i][j][0]);
        inc(dp[i + 1][j][0], (long long)min(k, s[i] - '0') * dp[i][j][1]);
        inc(dp[i + 1][j + 1][0],
            (long long)max(0, s[i] - '0' - k) * dp[i][j][1]);
        inc(dp[i + 1][j + (s[i] - '0' >= k ? 1 : 0)][1], dp[i][j][1]);
      }
    for (int j = (0); j <= (n); ++j)
      for (int eq = (0); eq < (2); ++eq)
        inc(ret, (long long)dp[n][j][eq] * ones[j]);
  }
  printf("%d\n", ret);
}
int main() {
  run();
  return 0;
}