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>
#include <cassert>
using namespace std;
const long long mod = (1e9) + 7;

long long mod_pow(long long x, long long k){
  long long ret = 1;
  while(k > 0){
    if(k&1){
      ret *= x;
      ret %= mod;
    }
    x *= x;
    x %= mod;
    k /= 2;
  }
  return ret;
}

int main(){
  long long S;
  cin >> S;
  long long ans = 0;
  for(int i = 1; i <= S; ++i){
    long long i_ = S/i, r_ = S%i;
    //i が i_ 個
    if(((!r_) && (i-1 > 8 || 9*mod_pow(10,i-1) >= i_))){
      ans += ((9*mod_pow(10,i-1))%mod - i_ + 1 + mod)%mod;
      ans %= mod;
    }
    //長さ i の区間の個数
    //i_ がi - r 個、i_+1 が r 個
    if(r_ && (i_-1 > 8 || 9*mod_pow(10,i_-1) >= i-r_) && (i_ > 8 || 9*mod_pow(10,i_) >= r_)){
      ++ans;
      ans %= mod;
    }
  }
  
  //cerr << ans << endl;
  
  long long C[10], D[10];
  C[0] = 0;
  C[1] = 9;
  for(int i = 1; i < 9; ++i) C[i+1] = C[i]*10;
  for(int i = 0; i < 10; ++i) D[i] = 0;
  long long r = 1, l = 1, s = 0;
  while(S > s){
    if(s+C[r]*r <= S){
      s += C[r]*r;
      D[r] += C[r];
      C[r] = 0;
      ++r;
    }else{
      long long t = (S-s+r-1)/r;
      D[r] += t;
      C[r] -= t;
      s += t*r;
    }
  }
  while(l < r){
    while(s > S){
      if(s - S >= l*D[l]){
        s -= l*D[l];
        C[l] += D[l];
        D[l] = 0;
        ++l;
      }else{
        long long t = (s - S + l - 1)/l;
        C[l] += t;
        D[l] -= t;
        s -= t*l;
      }
    }
    //if(l >= r-1) break;
    if(l < r-1 && s == S){
      ++ans;
      ans %= mod;
    }
    if(!C[r]) ++r;
    --C[r];
    ++D[r];
    s += r;
  }
  cout << ans << endl;
  return 0;
}