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;
const int mod = 1e9 + 7;
char s[707];
int n, pw[11][707], c[707][707];
void init() {
  for (int i = 0; i < 11; i++) {
    pw[i][0] = 1;
    for (int j = 1; j < 707; j++) pw[i][j] = 1ll * i * pw[i][j - 1] % mod;
  }
  for (int i = 0; i < 707; i++) c[0][i] = 0, c[i][0] = 1;
  for (int i = 1; i < 707; i++)
    for (int j = 0; j < 707; j++) {
      c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
      if (c[i][j] >= mod) c[i][j] -= mod;
    }
}
int ans, cnt[10], pre[707], suf[707];
void solve(int k) {
  memset(cnt, 0, sizeof cnt);
  for (int i = 0; i <= k; i++) cnt[s[i] - '0']++;
  for (int d = 1; d < 10; d++) {
    int a = 0, b = 0;
    for (int i = 0; i < d; i++) a += cnt[i];
    for (int i = 9; i > d; i--) b += cnt[i];
    for (int i = 0; i < a; i++) pre[i] = 0, suf[i] = 0;
    for (int i = n - b; i < n; i++) pre[i] = 0, suf[i] = 0;
    for (int i = a; i < n - b; i++) {
      if (cnt[d] == 0) {
        int x = i - a, y = n - b - i;
        pre[i] = 1ll * c[x + y][x] * pw[d][x] % mod *
                 (pw[10 - d][y] - pw[9 - d][y] + mod) % mod;
        x = n - b - i - 1, y = i - a + 1;
        suf[i] = 1ll * c[x + y][x] * pw[9 - d][x] % mod *
                 (pw[d + 1][y] - pw[d][y] + mod) % mod;
      } else {
        int x = i - a, y = n - b - i - cnt[d];
        pre[i] = 1ll * c[x + y][x] * pw[d][x] % mod * pw[10 - d][y] % mod;
        x = n - b - i - 1, y = i - a + 1 - cnt[d];
        suf[i] = 1ll * c[x + y][x] * pw[9 - d][x] % mod * pw[d + 1][y] % mod;
      }
    }
    int g = 0;
    for (int i = 0; i < n; i++) {
      g += pre[i];
      if (g >= mod) g -= mod;
      if (i) {
        g -= suf[i - 1];
        if (g < 0) g += mod;
      }
      ans = (ans + 1ll * g * pw[10][n - i - 1] % mod * d) % mod;
    }
  }
}
int main() {
  init();
  scanf("%s", s);
  n = strlen(s);
  ans = 0;
  for (int i = 0; i < n; i++) {
    char up = s[i];
    for (s[i] = '0'; s[i] < up; s[i]++) solve(i);
  }
  solve(n - 1);
  cout << ans << endl;
}