Problem: For a positive integer n, let us define f(n) as the number of digits in base 10.

You are given an integer S. Count the number of the pairs of positive integers (l, r) (l \leq r) such that f(l) + f(l + 1) + ... + f(r) = S, and find the count modulo 10^9 + 7.

Constraints

* 1 \leq S \leq 10^8

Input

Input is given from Standard Input in the following format:


S


Output

Print the answer.

Examples

Input

1


Output

9


Input

2


Output

98


Input

123


Output

460191684


Input

36018


Output

966522825


Input

1000


Output

184984484

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, N = 3e7 + 1;
const int l1 = 10000000;
const int l2 = 25500000;
int d[N];

int sub(int x, int y) {
  return (x -= y) < 0 ? x + mod : x;
}

int add(int x, int y) {
  return (x += y) >= mod ? x - mod : x;
}

void Add(int &x, int y) {
  x = add(x, y);
}

int mul(int x, int y) {
  return 1ll * x * y % mod;
}

void Mul(int &x, int y) {
  x = mul(x, y);
}

int q_pow(int x, int y) {
  int ans = 1;
  for(; y; y >>= 1) {
    if(y & 1) Mul(ans, x);
    Mul(x, x);
  }
  return ans;
}

void init() {
  for(int i = 1, k = 1; i < l1; i *= 10, ++k) {
    for(int j = i; j < i * 10; ++j) d[j] = k;
  }
  for(int i = l1; i <= l2; ++i) d[i] = 8;
}

int cal1(int n) {
  int ans = 0;
  for(int l = 1, r = 1, cnt = 1; l < l1; ++l) {
    for(; r + 1 <= l2 && cnt + d[r + 1] <= n; ++r, cnt += d[r]);
    if(cnt == n) ans++;
//    printf("%d %d\n", l,r);
    cnt -= d[l];
    if(r == l2) break;
  }
//  printf("%d\n", ans);
  return ans;
}

int cal2(int n) {
  int p = n / 8, ans = p;
  for(int i = 1; i <= p; ++i) {
    if(n % i == 0) {
      Add(ans, sub(mul(9, q_pow(10, n / i - 1)), i));
    }
  }
  return ans;
}

int main() {
  init();
  int n;
  scanf("%d", &n);
  printf("%d\n", add(cal1(n), cal2(n)));
  return 0;
}