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 <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>

using namespace std;
typedef long long ll;
ll MOD=1e9+7L;
ll ans;
ll f[25000000];

int S;
vector<ll> d,dd;

ll mod_pow(ll x,ll n){
  ll ret=1L;
  while(n){
    if(n%2){
     ret=(ret*x)%MOD;
    }
    n/=2L;
    x=(x*x)%MOD;
  }
  return ret;
}

void divisor(int n){
  for(int i=1; i<=sqrt(n); i++){
    if(n%i==0){
      int a=i;
      int b=n/i;
      d.push_back(a);
      if(a!=b) d.push_back(b);
    }
  }
}

int digit(int n){
  if(n/10==0) return 1;
  if(n/100==0) return 2;
  if(n/1000==0) return 3;
  if(n/10000==0) return 4;
  if(n/100000==0) return 5;
  if(n/1000000==0) return 6;
  if(n/10000000==0) return 7;
  if(n/100000000==0) return 8;
  return 0;
}

int cnt(){
  int ret=0;
  int s=1,t=1,sum=f[s];
  while(t<25000000){
    if(sum>=S){
      if(sum==S){
        if(f[s]<8) ret++;
      } 
      sum-=f[s];
      s++;
    }
    if(sum<S){
      t++; sum+=f[t];
    }
  }
  return ret;
}

int main() {

cin.tie(0);
ios::sync_with_stdio(false);

cin>>S;
divisor(S);

for(int i=0; i<d.size(); i++){
  if(d[i]>=8){
    ll n=S/d[i];
    ll add=9*mod_pow(10,d[i]-1)-n+1+MOD;
    if(add) ans=(ans+add)%MOD;
  }
}

int m=S/8;

for(int i=1; i<=sqrt(S); i++){
    if(S%i==0){
      int a=i;
      int b=S/i;
      if(a<=m) dd.push_back(a);
      if(a!=b) if(b<=m) dd.push_back(b);
    }
}

ans=(ans+m-dd.size()+MOD)%MOD;

for(int i=1; i<25000000; i++){
  f[i]=digit(i);
}

ans=(ans+cnt())%MOD;

cout<<ans<<endl;

}