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 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double PI = acos(-1);
template <class T, class S>
inline void add(T& a, S b) {
  a += b;
  if (a >= mod) a -= mod;
}
template <class T, class S>
inline void sub(T& a, S b) {
  a -= b;
  if (a < 0) a += mod;
}
template <class T, class S>
inline bool chkmax(T& a, S b) {
  return a < b ? a = b, true : false;
}
template <class T, class S>
inline bool chkmin(T& a, S b) {
  return a > b ? a = b, true : false;
}
int n, cnt, Pow[N];
int v[N];
char s[N];
int dp[N];
int f[N][N][2];
int g[N][N][2];
int sum[N][N][2];
int pre[N][N][2];
int d, w;
int getRet1(int p, int ban, bool limit) {
  if (p == -1) return 1;
  if (!limit && ~dp[p]) return dp[p];
  int ret = 0;
  int up = limit ? v[p] : 9;
  for (int i = 0; i <= up; i++) {
    if (i == ban) continue;
    add(ret, getRet1(p - 1, ban, limit && (i == up)));
  }
  if (!limit) dp[p] = ret;
  return ret;
}
int getRet2(int p, int big, int big2, bool have, bool limit) {
  if (p == -1) {
    return (have && big > w) || (have && big2 <= w);
  }
  if (!limit) {
    int need = max(0, w - big + 1);
    int need2 = min(p + 1, w - big2);
    int ret = 0;
    if (have)
      ret = (sum[p][need][0] + sum[p][need][1]) % mod;
    else
      ret = sum[p][need][1];
    int gg = ret;
    if (need2 >= 0) {
      if (have)
        add(ret, (pre[p][need2][0] + pre[p][need2][1]) % mod);
      else
        add(ret, pre[p][need2][1]);
    }
    return ret;
  }
  int up = limit ? v[p] : 9;
  int ret = 0;
  for (int i = 0; i <= up; i++) {
    add(ret, getRet2(p - 1, big + (i > d), big2 + (i >= d), have || (i == d),
                     limit && (i == up)));
  }
  return ret;
}
int solve(int x) {
  int ret = 0;
  memset(f, 0, sizeof(f));
  memset(g, 0, sizeof(g));
  memset(dp, -1, sizeof(dp));
  memset(sum, 0, sizeof(sum));
  f[0][1][0] = 9 - x;
  f[0][0][1] = 1;
  f[0][0][0] = x;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j >= 0; j--) {
      add(f[i][j][0], 1LL * f[i - 1][j][0] * x % mod);
      if (j) add(f[i][j][0], 1LL * f[i - 1][j - 1][0] * (9 - x) % mod);
      add(f[i][j][1], 1LL * f[i - 1][j][1] * (x + 1) % mod);
      if (j) add(f[i][j][1], 1LL * f[i - 1][j - 1][1] * (9 - x) % mod);
      add(f[i][j][1], f[i - 1][j][0]);
    }
  }
  g[0][1][0] = 9 - x;
  g[0][1][1] = 1;
  g[0][0][0] = x;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j >= 0; j--) {
      add(g[i][j][0], 1LL * g[i - 1][j][0] * x % mod);
      if (j) add(g[i][j][0], 1LL * g[i - 1][j - 1][0] * (9 - x) % mod);
      add(g[i][j][1], 1LL * g[i - 1][j][1] * x % mod);
      if (j) add(g[i][j][1], 1LL * g[i - 1][j - 1][1] * (10 - x) % mod);
      if (j) add(g[i][j][1], 1LL * g[i - 1][j - 1][0]);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j >= 0; j--) {
      sum[i][j][0] = (f[i][j][0] + sum[i][j + 1][0]) % mod;
      sum[i][j][1] = (f[i][j][1] + sum[i][j + 1][1]) % mod;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i + 1; j++) {
      pre[i][j][0] = g[i][j][0];
      if (j) add(pre[i][j][0], pre[i][j - 1][0]);
      pre[i][j][1] = g[i][j][1];
      if (j) add(pre[i][j][1], pre[i][j - 1][1]);
    }
  }
  int ncnt = (cnt - getRet1(n - 1, x, 1) + mod) % mod;
  for (int i = 0; i < n; i++) {
    int tmp = ncnt;
    d = x, w = i;
    sub(tmp, getRet2(n - 1, 0, 0, 0, 1));
    add(ret, 1LL * Pow[i] * tmp % mod * x % mod);
  }
  return ret;
}
int main() {
  for (int i = Pow[0] = 1; i < N; i++) Pow[i] = 1LL * Pow[i - 1] * 10 % mod;
  scanf("%s", s);
  n = strlen(s);
  reverse(s, s + n);
  for (int i = n - 1; i >= 0; i--) {
    v[i] = s[i] - '0';
    cnt = 1LL * cnt * 10 % mod;
    add(cnt, v[i]);
  }
  add(cnt, 1);
  int ans = 0;
  for (int i = 1; i <= 9; i++) add(ans, solve(i));
  printf("%d\n", ans);
  return 0;
}