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;
template <typename T>
inline void read(T &t) {
  t = 0;
  char c = getchar();
  int f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -f;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    t = (t << 3) + (t << 1) + c - '0';
    c = getchar();
  }
  t *= f;
}
template <typename T, typename... Args>
inline void read(T &t, Args &...args) {
  read(t);
  read(args...);
}
template <typename T>
inline void write(T x) {
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
char s[705];
int len, sn[705], dp[705][705][2];
int mul(int a, int b) { return 1ll * a * b % 1000000007; }
int add(int a, int b) {
  return a + b >= 1000000007 ? a + b - 1000000007 : a + b;
}
void Add(int &a, int b) { a = add(a, b); }
int Work(int v) {
  memset(dp, 0, sizeof(dp));
  for (register int i = 0; i <= sn[1]; ++i) dp[1][i >= v][i == sn[1]]++;
  for (register int i = 1; i < len; ++i)
    for (register int j = 0; j <= i; ++j)
      for (register int k = 0; k < 2; ++k) {
        int now = dp[i][j][k];
        if (!now) continue;
        for (register int num = 0; num <= (k ? sn[i + 1] : 9); ++num)
          Add(dp[i + 1][j + (num >= v)][k & (num == sn[i + 1])], now);
      }
  int pow1 = 0, ans = 0;
  for (register int i = 0; i <= len; ++i)
    Add(ans, mul(pow1, add(dp[len][i][0], dp[len][i][1]))),
        pow1 = add(mul(pow1, 10), 1);
  return ans;
}
signed main() {
  scanf("%s", s + 1), len = strlen(s + 1);
  for (register int i = 1; i <= len; ++i) sn[i] = s[i] - '0';
  int ans = 0;
  for (register int i = 1; i < 10; ++i) Add(ans, Work(i));
  write(ans), putchar('\n');
  return 0;
}