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>
inline int read() {
  char c = getchar();
  int x = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - 48, c = getchar();
  return x;
}
const int mod = 1e9 + 7, maxn = 707;
inline int dqm(int x) { return x < 0 ? x + mod : x; }
inline int qm(int x) { return x >= mod ? x - mod : x; }
inline void upd(int &x, int y) { x = qm(x + y); }
int n, lm[maxn], pw[maxn];
char S[maxn];
int f[2][2][maxn], dp[2][2][maxn];
inline int calc(int v) {
  memset(dp, 0, sizeof(dp));
  memset(f, 0, sizeof(f));
  int o = 0;
  f[o][1][0] = 1;
  for (register int i = 1; i <= n; i++, o ^= 1) {
    memset(f[o ^ 1], 0, sizeof(f[o ^ 1]));
    memset(dp[o ^ 1], 0, sizeof(dp[o ^ 1]));
    for (register int j = 0; j < i; ++j) {
      for (register int k = 0; k <= 9; ++k) {
        upd(f[o ^ 1][0][j + (k >= v)], f[o][0][j]);
        if (k < v)
          upd(dp[o ^ 1][0][j], dp[o][0][j]);
        else {
          if (k > v) upd(dp[o ^ 1][0][j + 1], 10ll * dp[o][0][j] % mod);
          if (k == v) {
            upd(dp[o ^ 1][0][j + 1], dp[o][0][j]);
            upd(dp[o ^ 1][0][j + 1], 1ll * f[o][0][j] * pw[j] % mod);
          }
        }
      }
      for (register int k = 0; k <= lm[i]; ++k) {
        upd(f[o ^ 1][k == lm[i]][j + (k >= v)], f[o][1][j]);
        if (k < v)
          upd(dp[o ^ 1][k == lm[i]][j], dp[o][1][j]);
        else {
          if (k > v)
            upd(dp[o ^ 1][k == lm[i]][j + 1], 10ll * dp[o][1][j] % mod);
          if (k == v) {
            upd(dp[o ^ 1][k == lm[i]][j + 1], dp[o][1][j]);
            upd(dp[o ^ 1][k == lm[i]][j + 1], 1ll * f[o][1][j] * pw[j] % mod);
          }
        }
      }
    }
  }
  int nw = 0;
  for (register int i = 0; i <= n; i++) upd(nw, qm(dp[o][0][i] + dp[o][1][i]));
  return nw;
}
int main() {
  scanf("%s", S + 1), n = strlen(S + 1);
  pw[0] = 1;
  int ans = 0;
  for (register int i = 1; i <= n; i++) lm[i] = S[i] - '0';
  for (register int i = 1; i <= n; i++) pw[i] = 10ll * pw[i - 1] % mod;
  for (register int i = 1; i <= 9; ++i) upd(ans, 1ll * i * calc(i) % mod);
  printf("%d\n", ans);
  return 0;
}