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 mod = 1e9 + 7;
int n, X, sl, fh, ans, a[100010], pw[100010], dp[710][710][2];
char s[100010];
int rd() {
  sl = 0;
  fh = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') sl = sl * 10 + ch - '0', ch = getchar();
  return sl * fh;
}
void upd(int &x, int y) {
  if ((x += y) >= mod) x -= mod;
}
int dfs(int p, int K, int flg) {
  if (p > n) return pw[K];
  if (~dp[p][K][flg]) return dp[p][K][flg];
  int ed = flg ? a[p] : 9, &res = dp[p][K][flg];
  res = 0;
  for (int i = 0; i <= ed; ++i)
    upd(res, dfs(p + 1, K + (i >= X), flg && (i == ed)));
  return res;
}
void solve() {
  memset(dp, -1, sizeof(dp));
  upd(ans, dfs(1, 0, 1));
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i) pw[i] = (10ll * pw[i - 1] + 1) % mod;
  for (int i = 1; i <= n; ++i) a[i] = s[i] - '0';
  for (int i = 1; i <= 9; ++i) X = i, solve();
  printf("%d\n", ans);
  return 0;
}