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 <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

const int mod = 1e9 + 7;

int main() {
  int sum;
  scanf("%d", &sum);

  vector<int> pow10(7 + 1);
  pow10[0] = 1;
  for (int i = 1; i < (int)pow10.size(); ++i)
    pow10[i] = 10LL * pow10[i - 1] % mod;

  vector<int> f((int)1e7);
  f[0] = 0;
  for (int d = 1; d <= 7; ++d) {
    for (int i = pow10[d - 1]; i < pow10[d]; ++i)
      f[i] = d;
  }

  int result = 0;

  int current_sum = 1;
  int r = 1;
  for (int l = 1; l < (int)1e7; ++l) {
    while (current_sum < sum) {
      ++r;
      if (r < (int)1e7) current_sum += f[r];
      else current_sum += 8;
    }
    if (current_sum == sum) {

      ++result;
      if (result >= mod) result -= mod;
    }
    assert(l <= r);
    current_sum -= f[l];
  }

  int pow10fl = 1e8;
  int pow10fl1 = 1e7;

  for (int fl = 8; fl <= sum; ++fl) {
    if (sum % fl == 0) {
      int many = sum / fl;
      result += pow10fl - pow10fl1 - many + 1;
      result %= mod;
      if (result < 0) result += mod;
    }

    int min_b = sum % fl;
    if (min_b == 0) min_b = fl;
    if ((sum - min_b) / fl - min_b >= 1) {
      int max_k = (sum - 1 - (lint)min_b * (fl + 1)) / ((lint)fl * (fl + 1));
      result += max_k + 1;
      if (result >= mod) result -= mod;
    }

    pow10fl = 10LL * pow10fl % mod;
    pow10fl1 = 10LL * pow10fl1 % mod;
  }
  printf("%d\n", result);
  return 0;
}