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 double PI = acos(-1);
const int N = 710;
const int oo = 1e9;
const int MOD = 1000000007;
pair<int, int> dp[N][2][N];
inline void add(int &f, int s) { f = (1ll * f + s) % MOD; }
inline void add(pair<int, int> &f, pair<int, int> s) {
  add(f.first, s.first);
  add(f.second, s.second);
}
string s;
long long cur, pw[N];
pair<int, int> calc(int idx, int lr, bool first) {
  if (lr < 0) return make_pair(0, 0);
  if (idx == s.size()) return make_pair(0, lr == 0);
  pair<int, int> &ret = dp[idx][first][lr];
  if (ret.first != -1) return ret;
  ret = make_pair(0, 0);
  for (int i = 0; i <= (first ? s[idx] - '0' : 9); ++i) {
    pair<int, int> g =
        calc(idx + 1, lr - (i > cur), first && (s[idx] - '0' == i));
    if (i >= cur) g.first = (g.first * 10ll) % MOD;
    if (i == cur) add(g.first, (((1ll * g.second * cur) % MOD * pw[lr]) % MOD));
    add(ret, g);
  }
  return ret;
}
int main() {
  cin >> s;
  pw[0] = 1;
  for (int i = 1; i <= s.size(); ++i) pw[i] = (10ll * pw[i - 1]) % MOD;
  pair<int, int> an = make_pair(0, 0);
  for (cur = 1; cur <= 9; ++cur) {
    memset(dp, -1, sizeof dp);
    for (int j = 0; j <= s.size(); ++j) {
      add(an, calc(0, j, 1));
    }
  }
  printf("%d\n", an.first);
  return 0;
}