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>
#define ll long long
#define mod 1000000007
using namespace std;

ll n,ans;

inline void U(ll &x,ll y){
  x+=y; if (x>=mod) x-=mod;
}

ll K(ll x,int y){ return y? K(x*x%mod,y/2)*(y&1?x:1)%mod: 1; }
void ddd(int x){
  if (x<10) return;
  ll an=K(10,x-1)*9%mod-n/x+1;
  an=(an%mod+mod)%mod;
  U(ans,an);
}
void sth_above_ten(){ // >=10
  static ll x,y,sum;
  for (int i=9;i<n;++i){
    // ix+ (i+1)y =n  x,y>0
    // i(x+y) =n-y
    sum=(n-1)/i; y=n-sum*i;
    if (sum<=y) continue;
    x=sum-y;
    U(ans,(x-1)/(i+1)+1);
  }
  for (int i=1;i*i<=n;++i)
    if (n%i==0){
      ddd(i);
      if (i*i!=n) ddd(n/i);
    }
}

void exgcd(ll a,ll b,ll &c,ll &x,ll &y){
  if (!b){
    y=0; x=1; c=a;
  }else{
    exgcd(b,a%b,c,x,y);
    ll xx=x, yy=y;
    x=yy; y=xx-a/b*yy;
  }
}

ll up(ll x,ll y){ return (x+y-1)/y; }

void cal(ll a,ll limx,ll b,ll limy,ll c){
  ll x,y,g,an,d;
  exgcd(a,b,g,x,y);
  if (c%g) return;
  x*=c/g; y*=c/g; a/=g; b/=g;
  if (x<=0){
    d=abs(x)/b+10;
    x+=d*b;
    y-=d*a;
  }
  d=(x-1)/b;
  x-=d*b; y+=d*a;
  if (y<1) return;
  if (y>limy){
    d=up(y-limy,a);
    x+=d*b; y-=d*a;
  }
  if (y<1) return;
  if (x>limx) return;
  an=(limx-x)/b+1;
  an=min(an,(y-1)/a+1);
  ans+=an;
  ans%=mod;
}

void all_below_ten(){ // <10
  static ll las,cc[10];
  cc[1]=9;
  for (int i=2;i<=9;++i)
    cc[i]=cc[i-1]*10;
  for (int i=1;i<=9;++i)
    for (int j=i+1;j<=9;++j){
      las=n;
      for (int k=i+1;k<j;++k) las-=cc[k]*k;
      if (las<i+j) continue;
      cal(i,cc[i],j,cc[j],las);
    }
  for (int i=1;i<=9;++i)
    if (n%i==0){
      ll nd=n/i;
      if (nd>cc[i]) continue;
      ans+=cc[i]-nd+1;
      ans%=mod;
    }
}

int main(){
  cin>>n;
  sth_above_ten();
  all_below_ten();
  cout<<ans<<endl;
}