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 f[710][710][2], p[710][11], x[710];
char s[710];
const int frog = 1e9 + 7;
int ans, nowt;
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = 1; i <= n; i++) x[i] = s[i] - 48;
  for (int j = 0; j < 10; j++) {
    memset(f, 0, sizeof(f));
    if (j > x[n]) {
      f[n][0][0] = x[n] + 1;
      f[n][0][1] = j - x[n] - 1;
      f[n][1][1] = 10 - j;
    } else {
      f[n][0][0] = j;
      f[n][1][0] = x[n] - j + 1;
      f[n][1][1] = 10 - x[n] - 1;
    }
    for (int i = n - 1; i >= 1; i--) {
      if (j > x[i]) {
        f[i][0][0] = ((f[i + 1][0][0] + f[i + 1][0][1]) * 1ll * x[i] % frog +
                      f[i + 1][0][0]) %
                     frog;
        f[i][0][1] =
            ((f[i + 1][0][0] + f[i + 1][0][1]) * 1ll * (j - x[i] - 1) % frog +
             f[i + 1][0][1]) %
            frog;
        for (int t = 1; t <= n - i + 1; t++) {
          f[i][t][0] = ((f[i + 1][t][0] + f[i + 1][t][1]) * 1ll * x[i] % frog +
                        f[i + 1][t][0]) %
                       frog;
          f[i][t][1] =
              ((f[i + 1][t][0] + f[i + 1][t][1]) * 1ll * (j - x[i] - 1) % frog +
               f[i + 1][t][1] +
               (f[i + 1][t - 1][0] + f[i + 1][t - 1][1]) * 1ll * (10 - j) %
                   frog) %
              frog;
        }
      } else {
        f[i][0][0] = (f[i + 1][0][0] + f[i + 1][0][1]) * 1ll * j % frog;
        for (int t = 1; t <= n - i + 1; t++) {
          f[i][t][0] = ((f[i + 1][t][0] + f[i + 1][t][1]) * 1ll * j % frog +
                        (f[i + 1][t - 1][0] + f[i + 1][t - 1][1]) * 1ll *
                            (x[i] - j) % frog +
                        f[i + 1][t - 1][0]) %
                       frog;
          f[i][t][1] = ((f[i + 1][t - 1][0] + f[i + 1][t - 1][1]) * 1ll *
                            (10 - x[i] - 1) % frog +
                        f[i + 1][t - 1][1]) %
                       frog;
        }
      }
      for (int i = n; i > 0; i--) {
        f[1][i][0] = (f[1][i + 1][0] + f[1][i][0]) % frog;
        p[i][j] = f[1][i][0];
      }
    }
  }
  ans = 0, nowt = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 9; j++)
      ans = (ans +
             (p[i][j] - p[i][j + 1] + frog) * 1ll * nowt % frog * j % frog) %
            frog;
    nowt = nowt * 10ll % frog;
  }
  printf("%d", ans);
}