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;
int read() {
  int out = 0, sgn = 1;
  char jp = getchar();
  while (jp != '-' && (jp < '0' || jp > '9')) jp = getchar();
  if (jp == '-') sgn = -1, jp = getchar();
  while (jp >= '0' && jp <= '9') out = out * 10 + jp - '0', jp = getchar();
  return out * sgn;
}
const int P = 1e9 + 7;
int add(int a, int b) { return a + b >= P ? a + b - P : a + b; }
void inc(int &a, int b) { a = add(a, b); }
int mul(int a, int b) { return 1LL * a * b % P; }
const int N = 700 + 10;
int n, f[N][N][2], g[N][N][2], pw[N];
char s[N];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  int ans = 0;
  for (int num = 1; num < 10; ++num) {
    memset(f, 0, sizeof f);
    memset(g, 0, sizeof g);
    g[0][0][1] = 1;
    for (int i = 0; i < n; ++i) {
      int pw = 1;
      for (int j = 0; j <= i; ++j) {
        for (int limit = 0; limit <= 1; ++limit)
          if (g[i][j][limit]) {
            int mx = limit ? s[i + 1] - '0' : 9;
            for (int k = 0; k <= mx; ++k) {
              int t = limit && k == mx;
              if (k >= num) {
                inc(f[i + 1][j + 1][t],
                    add(f[i][j][limit], mul(pw, g[i][j][limit])));
                inc(g[i + 1][j + 1][t], g[i][j][limit]);
              } else {
                inc(f[i + 1][j][t], f[i][j][limit]);
                inc(g[i + 1][j][t], g[i][j][limit]);
              }
            }
          }
        pw = mul(pw, 10);
      }
    }
    int res = 0;
    for (int j = 0; j <= n; ++j)
      for (int limit = 0; limit <= 1; ++limit) inc(res, f[n][j][limit]);
    inc(ans, res);
  }
  printf("%d\n", ans);
  return 0;
}