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 <iostream>

// 1 x 9
// 2 x 90
// 3 x 900
// ...

const int M = 1000000007;

int dk(int p) {
  if (p >= 100000000) return 9;
  else if (p >= 10000000) return 8;
  else if (p >= 1000000) return 7;
  else if (p >= 100000) return 6;
  else if (p >= 10000) return 5;
  else if (p >= 1000) return 4;
  else if (p >= 100) return 3;
  else if (p >= 10) return 2;
  return 1;
}

int powmod(int p) {
  if (p == 0) return 1;
  else if (p == 1) return 10;
  else if ((p & 1) == 1) return (10 * (long long)powmod(p - 1)) % M;
  const int x = powmod(p >> 1);
  return (x * (long long)x % M);
}

int main() {
  using namespace std;
  ios::sync_with_stdio(false);

  int S;
  cin >> S;

  // (1) Check when d(l) <= 7
  int i = 1, j = 1;
  int sum = 0, ans = 0;
  for (; i < 10000000; ++i) {
    for (; sum < S; ++j) {
      sum += dk(j);
    }
    if (sum == S) ++ans; // [i, j)
    sum -= dk(i);
  }
  ans %= M;

  // (2) Check when d(l) > 7
  const int S2 = (S >> 3);
  for (int i = 1; i <= S2; ++i) {
    if (S % i == 0) {
      ans = (ans + (9 * (long long)powmod(S / i - 1)) + M - (i - 1)) % M;
    } else {
      ans = (ans + 1) % M;
    }
  }

  cout << ans << '\n';
  return 0;
}