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 long long MOD = 1e9 + 7;
long long f[705][705][2][2], digit[705], num, ans;
long long quick_pow(long long a, long long x) {
  long long ans = 1;
  while (x) {
    if (x & 1) ans = ans * a % MOD;
    a = a * a % MOD;
    x >>= 1;
  }
  return ans;
}
void dp(int x) {
  memset(f, 0, sizeof(f));
  f[0][0][0][1] = 1;
  for (int i = 0; i <= num; i++) {
    for (int j = 0; j <= i; j++) {
      for (int k = 0; k < 10; k++) {
        if (k > digit[i + 1]) {
          if (k > x) {
            f[i + 1][j + 1][0][0] += f[i][j][0][0];
            f[i + 1][j + 1][1][0] += f[i][j][1][0];
          } else if (k == x) {
            f[i + 1][j][1][0] += f[i][j][0][0];
            f[i + 1][j][0][0] += f[i][j][0][0];
            f[i + 1][j + 1][1][0] += f[i][j][1][0];
          } else {
            f[i + 1][j][0][0] += f[i][j][0][0];
            f[i + 1][j][1][0] += f[i][j][1][0];
          }
        } else if (k == digit[i + 1]) {
          if (k > x) {
            f[i + 1][j + 1][0][0] += f[i][j][0][0];
            f[i + 1][j + 1][0][1] += f[i][j][0][1];
            f[i + 1][j + 1][1][0] += f[i][j][1][0];
            f[i + 1][j + 1][1][1] += f[i][j][1][1];
          } else if (k == x) {
            f[i + 1][j][1][0] += f[i][j][0][0];
            f[i + 1][j][0][0] += f[i][j][0][0];
            f[i + 1][j][1][1] += f[i][j][0][1];
            f[i + 1][j][0][1] += f[i][j][0][1];
            f[i + 1][j + 1][1][0] += f[i][j][1][0];
            f[i + 1][j + 1][1][1] += f[i][j][1][1];
          } else {
            f[i + 1][j][0][0] += f[i][j][0][0];
            f[i + 1][j][0][1] += f[i][j][0][1];
            f[i + 1][j][1][0] += f[i][j][1][0];
            f[i + 1][j][1][1] += f[i][j][1][1];
          }
        } else {
          if (k > x) {
            f[i + 1][j + 1][0][0] += f[i][j][0][0];
            f[i + 1][j + 1][0][0] += f[i][j][0][1];
            f[i + 1][j + 1][1][0] += f[i][j][1][0];
            f[i + 1][j + 1][1][0] += f[i][j][1][1];
          } else if (k == x) {
            f[i + 1][j][1][0] += f[i][j][0][0];
            f[i + 1][j][0][0] += f[i][j][0][0];
            f[i + 1][j][1][0] += f[i][j][0][1];
            f[i + 1][j][0][0] += f[i][j][0][1];
            f[i + 1][j + 1][1][0] += f[i][j][1][0];
            f[i + 1][j + 1][1][0] += f[i][j][1][1];
          } else {
            f[i + 1][j][0][0] += f[i][j][0][0];
            f[i + 1][j][0][0] += f[i][j][0][1];
            f[i + 1][j][1][0] += f[i][j][1][0];
            f[i + 1][j][1][0] += f[i][j][1][1];
          }
        }
        f[i + 1][j + 1][0][0] %= MOD;
        f[i + 1][j + 1][0][1] %= MOD;
        f[i + 1][j + 1][1][0] %= MOD;
        f[i + 1][j + 1][1][1] %= MOD;
        f[i + 1][j][0][0] %= MOD;
        f[i + 1][j][0][1] %= MOD;
        f[i + 1][j][1][0] %= MOD;
        f[i + 1][j][1][1] %= MOD;
      }
    }
  }
  for (int i = 0; i <= num; i++) {
    ans += (f[num][i][1][0] + f[num][i][1][1]) % MOD * quick_pow(10, i) % MOD *
           x % MOD;
    ans %= MOD;
  }
}
char s[1005];
void read() {
  scanf("%s", s);
  num = strlen(s);
  for (int i = 0; i < num; i++) digit[i + 1] = s[i] - '0';
}
int main() {
  read();
  for (int i = 1; i < 10; i++) dp(i);
  printf("%lld\n", ans);
  return 0;
}