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;

using int64 = long long;

const int mod = 1e9 + 7;

char G[100000000];

int main()
{
  int S;
  cin >> S;


  int64 tail = 0, tailsum = 0, sum = 0;
  int64 fact, ret = 0;


  for(int i = 1; i < 10; i++) {
    G[i] = 1;
  }
  for(int i = 1; i < 100000000; i++) {
    if(i * 10 < 100000000) G[i * 10] = G[i] + 1;
    G[i] = max(G[i], G[i - 1]);
  }
  for(int i = 1; i < 10000000; i++) {
    while(sum + S > tailsum) tailsum += G[tail++];
    if(sum + S == tailsum) ++ret;
    sum += G[i];
  }
  fact = 10000000;
  for(int i = 8; i <= 100000002; i++) {
    if(S % i == 0) {
      int64 need = S / i;
      int64 sz = fact * 9 % mod;
      (sz += 1) %= mod;
      (sz += mod - need) %= mod;
      (ret += sz) %= mod;
    }
    (fact *= 10) %= mod;
  }

  for(int i = 8; i < S; i++) {
    int64 SS = (S - i - (i + 1));
    if(SS >= 0) {
      int64 YY = SS % i;
      int64 SYO = (SS - YY) / i;
      if(YY <= SYO) {
        ret += 1 + ((SYO - YY) / (i + 1));
        ret %= mod;
      }
    }
  }

  cout << ret << endl;
}