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 N = 700 + 5, M = 10 + 5, P = 1e9 + 7;
int dp[N][M][M], pwr[N][M], C[N][N];
int n, ans, cnt[M], sum[N];
string s;
inline void calc() {
  for (int i = 9, p = 0; ~i; i--) {
    for (int j = 0; j <= n; j++)
      (ans += 1LL * sum[cnt[i] - 1] * pwr[p + j][10] % P * C[n][j] % P *
              pwr[n - j][i + 1] % P * pwr[j][9 - i] % P * i % P) %= P;
    (ans += 1LL * dp[n][9][i] * pwr[p += cnt[i]][10] % P * i % P) %= P;
  }
}
inline void read_input() {
  cin >> s;
  n = s.size();
}
inline void solve() {
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++)
      C[i][j] = j ? (C[i - 1][j] + C[i - 1][j - 1]) % P : 1;
    for (int j = 0; j < 11; j++)
      pwr[i][j] = i ? 1LL * pwr[i - 1][j] * j % P : 1;
    sum[i] = (sum[i - 1] + pwr[i][10]) % P;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < 10; j++)
      for (int x = 0; x <= j; x++)
        for (int k = 0; k <= i; k++)
          if (x)
            (dp[i][j][x] += 1LL * C[i][k] * dp[i - k][j - 1][x - 1] % P) %= P;
          else
            (dp[i][j][x] += 1LL * C[i][k] * (sum[i - 1] - sum[i - k - 1]) % P *
                            pwr[i - k][j] % P) %= P;
}
inline void write_output() {
  for (auto c : s) {
    n--;
    for (int i = 0; i < c - '0'; i++) cnt[i]++, calc(), cnt[i]--;
    cnt[c - '0']++;
  }
  calc(), cout << ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  read_input(), solve(), write_output();
  return 0;
}