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>
const int N = 705, mo = 1e9 + 7;
using namespace std;
inline int gi() {
  char ch = getchar();
  int x = 0, q = 0;
  while (ch < '0' || ch > '9') ch == '-' ? q = 1 : 0, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return q ? (-x) : x;
}
char s[N];
int f[N][N][2];
void dp(int &x, int y) {
  x += y;
  if (x >= mo) x -= mo;
  return;
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1), x, y, ans = 0;
  for (int i = 1; i <= 9; ++i) {
    f[0][0][1] = 1;
    for (int j = 0; j < n; ++j)
      for (int k = 0; k <= j; ++k)
        for (int l = 0; l <= 1; ++l)
          if (f[j][k][l])
            for (int p = 0; p <= 9; ++p) {
              if (l && p > s[j + 1] - '0') continue;
              if (p == s[j + 1] - '0')
                y = l;
              else
                y = 0;
              x = k + (p >= i);
              dp(f[j + 1][x][y], f[j][k][l]);
            }
    for (int j = 1, k = 1; j <= n; ++j, k = 1ll * k * 10 % mo + 1)
      dp(ans, 1ll * (f[n][j][0] + f[n][j][1]) * k % mo);
    for (int j = 0; j <= n; ++j)
      for (int k = 0; k <= j; ++k)
        for (int l = 0; l <= 2; ++l) f[j][k][l] = 0;
  }
  cout << ans;
  return 0;
}