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;
#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
const long long maxn = 7e2 + 10, maxm = 2e3 + 10, lg = 18, mod = 1e9 + 7,
                inf = 1e18;
long long dp[maxn][maxn][2], ans, po[maxn];
string s;
void add(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  po[0] = 1;
  for (int i = 1; i < maxn; i++) po[i] = 10 * po[i - 1] % mod;
  cin >> s;
  for (int d = 1; d <= 9; d++) {
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 0; i < (long long)(s.size()); i++)
      for (int j = 0; j <= i; j++) {
        add(dp[i + 1][j][1], dp[i][j][1] * d % mod);
        add(dp[i + 1][j + 1][1], dp[i][j][1] * (10 - d) % mod);
        add(dp[i + 1][j + ((s[i] - '0') >= d)][0], dp[i][j][0]);
        add(dp[i + 1][j][1], dp[i][j][0] * min(d, s[i] - '0') % mod);
        add(dp[i + 1][j + 1][1], dp[i][j][0] * max(0, s[i] - '0' - d) % mod);
      }
    for (int i = (long long)(s.size()); i; i--) {
      add(dp[(long long)(s.size())][i][1], dp[(long long)(s.size())][i + 1][1] +
                                               dp[(long long)(s.size())][i][0]);
      add(ans, po[i - 1] * dp[(long long)(s.size())][i][1] % mod);
    }
  }
  cout << ans << endl;
  return 0;
}