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;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;

ll ans=0;
ll keta[35];
ll k[10];

ll solve1(ll i,ll k){
    if(i<=10) return max(0ll,9*(ll)pow(10,i-1)-k+1);

    else {
        ll kk=9;
        i--;
        for(ll j=0;j<35;j++){
            if(i>>j&1){
                kk*=keta[j];
                kk%=Mod;
            }
        }
        return (kk-k+1+Mod)%Mod;
    }
}

ll gcd(ll a,ll b){
    if(a<b) swap(a,b);
    if(a%b==0) return b;
    else return gcd(b,a%b);
}

ll solve2(ll i,ll j,ll s){
    ll g=gcd(i,j);
    if(s%g!=0) return 0;
    s=s/g;
    ll i1=i/g;
    ll j1=j/g;

    ll p=0;
    while(s%j1!=0&&p<=j1){
        s-=i1;
        p++;
    }

    
    ll q=s/j1;

    ll ans=0;
    while(p<=k[i]){
        if(p>0&&q<=k[j]&&q>0) ans+=1;
        p+=j1;
        q-=i1;
    }

    return ans;
}

int main(){
    ll i,j,l;
    ll s;
    cin>>s;
    if(s==1) {
        cout<<9<<endl;
        return 0;
    }

    
    k[1]=9;
    for(i=2;i<10;i++) k[i]=10*k[i-1];

    keta[0]=10;
    for(i=1;i<35;i++) keta[i]=(keta[i-1]*keta[i-1])%Mod;

    for(i=1;i*i<=s;i++){
        if(s%i==0){
            if(i*i==s) ans+=solve1(i,s/i);
            else ans+=solve1(i,s/i)+solve1(s/i,i);
            ans%=Mod;
        }
    }

    for(i=9;i<s;i++){
        ll rr=ans;
        ll ss=s;
        ll p=ss%i;
        if(p==0) p=i;
        ss-=p*(i+1);
        if(ss>0) ans+=1+ ss/(i*(i+1));
        if(ss>0&&ss%(i*(i+1))==0) ans--;
        ans%=Mod;
    }

    for(i=1;i<=8;i++){
        for(j=i+1;j<=9;j++){
            ll ss=s;
            for(l=i+1;l<j;l++){
                ss-=k[l]*l;
            }
            if(ss>0){
                ans+=solve2(i,j,ss);
                ans%=Mod;
                
            } 
        }
    }

    cout<<(ans+Mod)%Mod<<endl;

    return 0;
    
   
}