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;
template <class T>
void splitstr(const string &s, vector<T> &out) {
  istringstream in(s);
  out.clear();
  copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
static void redirect(int argc, const char **argv) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (argc > 1) {
    static filebuf f;
    f.open(argv[1], ios::in);
    cin.rdbuf(&f);
    if (!cin) {
      cerr << "Failed to open '" << argv[1] << "'" << endl;
      exit(1);
    }
  }
  if (argc > 2) {
    static filebuf f;
    f.open(argv[2], ios::out | ios::trunc);
    cout.rdbuf(&f);
    if (!cout) {
      cerr << "Failed to open '" << argv[2] << "'" << endl;
    }
  }
}
template <typename T, typename C, T Modulus>
class MR {
 private:
  struct tag_plus {};
  struct tag_minus {};
  struct tag_good {};
  T value;
  static_assert(std::numeric_limits<C>::max() / Modulus / Modulus > 0,
                "compute type is too small");
  static_assert(Modulus < std::numeric_limits<T>::max() / 2,
                "storage type is too small");
  void reduce(tag_plus) {
    if (value >= Modulus) value -= Modulus;
  }
  void reduce(tag_minus) {
    if (value < 0) value += Modulus;
  }
  void reduce(tag_good) {}

 public:
  static const T modulus = Modulus;
  MR() : value(0) {}
  MR(C value) : value(value % Modulus) { reduce(tag_minus()); }
  template <typename tag_t>
  MR(T value, tag_t tag) : value(value) {
    reduce(tag);
  }
  MR &operator=(C value) {
    this->value = value % Modulus;
    reduce(tag_minus());
    return *this;
  }
  MR operator+(MR b) const { return MR(value + b.value, tag_plus()); }
  MR operator-(MR b) const { return MR(value - b.value, tag_minus()); }
  MR operator*(MR b) const {
    return MR(C(value) * C(b.value) % Modulus, tag_good());
  }
  MR operator-() const { return MR(-value, tag_minus()); }
  MR &operator+=(MR b) {
    value += b.value;
    reduce(tag_plus());
    return *this;
  }
  MR &operator-=(MR b) {
    value -= b.value;
    reduce(tag_minus());
    return *this;
  }
  MR &operator*=(MR b) {
    value = C(value) * C(b.value) % Modulus;
    return *this;
  }
  bool operator==(MR b) const { return value == b.value; }
  bool operator!=(MR b) const { return value != b.value; }
  T get() const { return value; }
};
template <typename T, typename C, T Modulus>
static inline std::ostream &operator<<(std::ostream &o, MR<T, C, Modulus> mr) {
  return o << mr.get();
}
int main(int argc, const char **argv) {
  redirect(argc, argv);
  string x;
  cin >> x;
  int D = ((long long)(x).size());
  reverse(begin(x), end(x));
  MR<int, long long, 1000000007> ans;
  for (int d = 1; d <= 9; d++) {
    vector<MR<int, long long, 1000000007> > tbl[2];
    vector<MR<int, long long, 1000000007> > tbl2[2];
    tbl[0].push_back(1);
    tbl[1].push_back(1);
    for (int pass = 0; pass < D; pass++) {
      int cur = x[pass] - '0';
      tbl2[0].resize(tbl[0].size() + 1);
      tbl2[1].resize(tbl[1].size() + 1);
      for (int i = 0; i < ((long long)(tbl[0]).size()); i++) {
        tbl2[0][i + 1] = tbl[0][i] * (10 - d);
        tbl2[0][i] += tbl[0][i] * d;
        if (d <= cur) {
          tbl2[1][i + 1] = tbl[1][i];
          if (d < cur) tbl2[1][i + 1] += tbl[0][i] * (cur - d);
          tbl2[1][i] += tbl[0][i] * d;
        } else {
          tbl2[1][i] += tbl[1][i];
          tbl2[1][i] += tbl[0][i] * cur;
        }
      }
      tbl[0] = move(tbl2[0]);
      tbl[1] = move(tbl2[1]);
    }
    for (int i = ((long long)(tbl[1]).size()) - 1; i > 0; i--)
      tbl[1][i - 1] += tbl[1][i];
    MR<int, long long, 1000000007> p10 = 1;
    for (int i = 1; i < ((long long)(tbl[1]).size()); i++) {
      ans += tbl[1][i] * p10;
      p10 *= 10;
    }
  }
  cout << ans << '\n';
  return 0;
}