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 i, j, k, m, n, s, t;
const int mod = 1e9 + 7;
inline void read(int &x) {
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
}
const int N = 7e2 + 10;
char num[N];
int g[N];
int dp[N][N][11][2], p[N];
int main() {
  scanf("%s", num + 1);
  p[0] = 1;
  for (i = 1; i <= 701; i++) p[i] = (long long)p[i - 1] * 10 % mod;
  int l = strlen(num + 1);
  for (i = 1; i <= l; i++) g[i] = num[i] - '0';
  for (i = 0; i < g[1]; i++)
    for (j = 0; j <= 9; j++)
      if (i > j)
        dp[1][0][j][0] += 1;
      else
        dp[1][1][j][0] += 1;
  for (j = 0; j <= 9; j++)
    if (j < g[1])
      dp[1][0][j][1] = 1;
    else
      dp[1][1][j][1] = 1;
  for (i = 2; i <= l; i++)
    for (j = 0; j <= i; j++)
      for (k = 0; k <= 9; k++)
        for (s = 0; s <= 9; s++) {
          if (j - (s <= k) < 0) continue;
          dp[i][j][k][0] += dp[i - 1][j - (s <= k)][k][0],
              dp[i][j][k][0] %= mod;
          if (g[i] == s)
            dp[i][j][k][1] += dp[i - 1][j - (s <= k)][k][1],
                dp[i][j][k][1] %= mod;
          if (g[i] > s)
            dp[i][j][k][0] += dp[i - 1][j - (s <= k)][k][1],
                dp[i][j][k][0] %= mod;
        }
  int ans = 0;
  for (i = 1; i <= l; i++)
    for (j = 0; j <= 9; j++)
      dp[l][i][j][0] += dp[l][i - 1][j][0], dp[l][i][j][0] %= mod;
  for (i = 1; i <= l; i++)
    for (j = 1; j <= 9; j++)
      ans = (ans + (long long)(dp[l][i - 1][j - 1][0] - dp[l][i - 1][j][0]) *
                       p[l - i] % mod * j % mod) %
            mod;
  sort(g + 1, g + l + 1);
  for (i = 1; i <= l; i++) ans = (ans + (long long)p[l - i] * g[i]) % mod;
  printf("%d", (ans + mod) % mod);
  return 0;
}