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 INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 707;
const int MAX = 10;
const int MOD = static_cast<int>(1e9 + 7);
int n;
int a[MAXN];
char s[MAXN];
int dp[MAX][MAXN][MAXN][2];
void init();
void input();
void work();
int add(int x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
  return x;
}
void addv(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
int dec(int x, int y) {
  x -= y;
  if (x < 0) x += MOD;
  return x;
}
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() { scanf("%s", s); }
void work() {
  n = strlen(s);
  for (int i = 1; i <= n; ++i) a[i] = s[i - 1] - '0';
  for (int i = 0; i < MAX; ++i) dp[i][0][0][1] = 1;
  int ub;
  for (int i = 0; i < MAX; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 0; k < j; ++k) {
        for (int f = 0; f < 2; ++f) {
          ub = f ? (a[j] - 1) : 9;
          for (int a = 0; a <= (((ub) < (i)) ? (ub) : (i)); ++a)
            addv(dp[i][j][k + 1][0], dp[i][j - 1][k][f]);
          for (int a = i + 1; a <= ub; ++a)
            addv(dp[i][j][k][0], dp[i][j - 1][k][f]);
          if (f)
            addv(dp[i][j][k + ((a[j] <= i) ? 1 : 0)][1], dp[i][j - 1][k][f]);
        }
      }
    }
  }
  for (int i = 0; i < MAX; ++i)
    for (int j = n - 1; j >= 0; --j)
      addv(dp[i][n][j][0], dp[i][n][j + 1][0]),
          addv(dp[i][n][j][1], dp[i][n][j + 1][1]);
  int ans = 0;
  int cur = 1, sum;
  for (int i = n; i > 0; --i) {
    sum = 0;
    for (int j = 1; j < MAX; ++j)
      addv(sum,
           static_cast<int>(static_cast<long long>(j) *
                            dec(add(dp[j][n][i][0], dp[j][n][i][1]),
                                add(dp[j - 1][n][i][0], dp[j - 1][n][i][1])) %
                            MOD));
    addv(ans, static_cast<int>(static_cast<long long>(cur) * sum % MOD));
    cur = static_cast<int>(static_cast<long long>(cur) * 10 % MOD);
  }
  cout << ans << endl;
}