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;
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool d = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') d = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return d ? x : -x;
}
inline void write(long long x) {
  if (x < 0) x = -x, putchar('-');
  if (x >= 10) write(x / 10);
  putchar('0' + x % 10);
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
inline void writep(long long x) {
  write(x);
  putchar(' ');
}
inline unsigned long long rnd() {
  return ((unsigned long long)rand() << 30 ^ rand()) << 4 | rand() % 4;
}
const int N = 705, mo = 1e9 + 7;
int a[N], f[N][N][2], bin[N], ans, sum[N];
char s[N];
void upd(int &x, int y) {
  x += y;
  if (x >= mo) x -= mo;
}
int main() {
  for (int i = (int)(bin[0] = 1); i <= (int)(N - 1); i++)
    bin[i] = (long long)bin[i - 1] * 10 % mo;
  sum[0] = bin[0];
  for (int i = (int)(1); i <= (int)(N - 1); i++)
    sum[i] = (sum[i - 1] + bin[i]) % mo;
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = (int)(1); i <= (int)(n); i++) a[i] = s[i] - '0';
  for (int o = (int)(1); o <= (int)(9); o++) {
    memset(f, 0, sizeof(f));
    f[0][0][1] = 1;
    for (int i = (int)(0); i <= (int)(n - 1); i++)
      for (int j = (int)(0); j <= (int)(i); j++) {
        for (int k = (int)(0); k <= (int)(1); k++)
          if (f[i][j][k]) {
            for (int t = (int)(0); t <= (int)((k ? a[i + 1] : 9)); t++) {
              if (k == 0 || t < a[i + 1])
                upd(f[i + 1][j + (t >= o)][0], f[i][j][k]);
              else
                upd(f[i + 1][j + (t >= o)][1], f[i][j][k]);
            }
          }
      }
    for (int i = (int)(1); i <= (int)(n); i++) {
      int mjn = (f[n][i][0] + f[n][i][1]) % mo;
      upd(ans, (long long)mjn % mo * sum[i - 1] % mo);
    }
  }
  cout << ans;
}