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;
inline long long read() {
  long long nm = 0;
  bool fh = true;
  char cw = getchar();
  for (; !isdigit(cw); cw = getchar()) fh ^= (cw == '-');
  for (; isdigit(cw); cw = getchar()) nm = nm * 10 + (cw - '0');
  return fh ? nm : -nm;
}
namespace CALC {
inline int add(int x, int y) {
  return (x + y >= 1000000007) ? (x + y - 1000000007) : (x + y);
}
inline int mns(int x, int y) {
  return (x - y < 0) ? (x - y + 1000000007) : (x - y);
}
inline int mul(int x, int y) {
  return (long long)x * (long long)y % 1000000007;
}
inline void upd(int &x, int y) {
  x += y;
  (x >= 1000000007) ? (x -= 1000000007) : 0;
}
inline void dec(int &x, int y) {
  x -= y;
  (x < 0) ? (x += 1000000007) : 0;
}
inline int qpow(int x, int sq) {
  int res = 1;
  for (; sq; sq >>= 1, x = mul(x, x))
    if (sq & 1) res = mul(res, x);
  return res;
}
}  // namespace CALC
using namespace CALC;
int n, F[800][2], G[800][2], ans;
char ch[800];
int t[800];
inline int calc(int D) {
  memset(F, 0, sizeof(F)), memset(G, 0, sizeof(G)), F[n + 1][1] = 1;
  for (int i = n + 1; i > 1; --i)
    for (int j = 0; j < 2; j++)
      if (G[i][j] > 0 || F[i][j] > 0) {
        for (int d = ((j == 1) ? t[i - 1] : 9); d >= 0; --d) {
          int nxt = (j == 1 && d == t[i - 1]);
          upd(F[i - 1][nxt], F[i][j]);
          if (d >= D)
            upd(G[i - 1][nxt], add(mul(10, G[i][j]), F[i][j]));
          else
            upd(G[i - 1][nxt], G[i][j]);
        }
      }
  return add(G[1][0], G[1][1]);
}
int main() {
  scanf("%s", ch + 1), n = strlen(ch + 1), reverse(ch + 1, ch + n + 1);
  for (int i = 1; i <= n; i++) t[i] = ch[i] - '0';
  for (int i = 1; i <= 9; i++) upd(ans, calc(i));
  printf("%d\n", ans);
  return 0;
}