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 n;
char s[711];
const int mod = 1e9 + 7;
int kk[711][12], f[711][711][2];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int j = 0; j <= 9; j++) {
    int num = s[n] - '0';
    if (j > num) {
      f[n][0][0] = num + 1;
      f[n][1][0] = 0;
      f[n][0][1] = j - num - 1;
      f[n][1][1] = 10 - j;
    } else {
      f[n][0][0] = j;
      f[n][1][0] = num - j + 1;
      f[n][0][1] = 0;
      f[n][1][1] = 10 - num - 1;
    }
    for (int a = n - 1; a; a--) {
      int num = s[a] - '0';
      if (j > num) {
        f[a][0][0] =
            (1ll * (f[a + 1][0][0] + f[a + 1][0][1]) * num + f[a + 1][0][0]) %
            mod;
        f[a][0][1] = (1ll * (f[a + 1][0][0] + f[a + 1][0][1]) * (j - num - 1) +
                      f[a + 1][0][1]) %
                     mod;
        for (int b = 1, to = n - a + 1; b <= to; b++) {
          f[a][b][0] =
              (1ll * (f[a + 1][b][0] + f[a + 1][b][1]) * num + f[a + 1][b][0]) %
              mod;
          f[a][b][1] =
              (1ll * (f[a + 1][b - 1][0] + f[a + 1][b - 1][1]) * (10 - j) +
               1ll * (f[a + 1][b][0] + f[a + 1][b][1]) * (j - num - 1) +
               f[a + 1][b][1]) %
              mod;
        }
      } else {
        f[a][0][0] = (1ll * (f[a + 1][0][0] + f[a + 1][0][1]) * j) % mod;
        f[a][0][1] = 0;
        for (int b = 1, to = n - a + 1; b <= to; b++) {
          f[a][b][0] =
              (1ll * (f[a + 1][b][0] + f[a + 1][b][1]) * j +
               1ll * (f[a + 1][b - 1][0] + f[a + 1][b - 1][1]) * (num - j) +
               f[a + 1][b - 1][0]) %
              mod;
          f[a][b][1] = (1ll * (f[a + 1][b - 1][0] + f[a + 1][b - 1][1]) *
                            (10 - num - 1) +
                        f[a + 1][b - 1][1]) %
                       mod;
        }
      }
    }
    for (int i = n; i; i--)
      f[1][i][0] += f[1][i + 1][0], f[1][i][0] -= f[1][i][0] >= mod ? mod : 0,
          kk[i][j] = f[1][i][0];
  }
  int ans = 0;
  for (int i = 1, ten = 1; i <= n; i++) {
    for (int j = 0; j <= 9; j++)
      ans += 1ll * (kk[i][j] - kk[i][j + 1] + mod) * ten % mod * j % mod,
          ans -= ans >= mod ? mod : 0, ans += ans < 0 ? mod : 0;
    ten = 1ll * ten * 10 % mod;
  }
  printf("%d\n", ans);
  return 0;
}