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;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;
int mpow(int n,int m){
    int ret=1;
    while(m){
        if(m&1)ret=ret*n%mod;
        n=n*n%mod;
        m>>=1;
    }
    return ret;
}
inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}
int S;
int po[111];

signed main(){
    po[0]=1;
    for(int i=1;i<111;i++)po[i]=po[i-1]*10;

    cin>>S;

    int ans=0;
    for(int i=1;i<=7;i++){
        for(int j=i;j<=7;j++){
            int tmp=0;
            for(int k=i;k<=j;k++)tmp+=k*9*po[k-1];
            if(tmp>S)continue;
            int lim;
            if(i==1)lim=0;
            else lim=9*po[i-2]-1;
            for(int k=0;k<=lim;k++){
                int r=S-tmp-k*(i-1);
                if(r<0||r%(j+1)||r/(j+1)>=9*po[j])continue;
                ans++;
            }
        }
    }

    for(int i=1;i<=7;i++){
        for(int j=1;j<9*po[i-1];j++){
            int r=S-i*j;
            if(r<=0||r%(i+1)||r/(i+1)>=9*po[i])continue;
            ans++;
        }
    }

    ans%=mod;
    for(int i=1;i*i<=S;i++){
        if(S%i)continue;
        int tmp=S/i;
        if(!(i<=7&&tmp>=9*po[i-1]))add(ans,(9*mpow(10,i-1)-tmp+1+mod)%mod);


        int j=S/i;
        if(i==j)continue;
        tmp=S/j;
        if(!(j<=7&&tmp>=9*po[j-1]))add(ans,(9*mpow(10,j-1)-tmp+1+mod)%mod);
    }

    /*
    for(int i=8;i<123;i++){
        for(int j=1;i*j<S;j++){
            int r=S-i*j;
            if(r%(i+1))continue;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
    */

    int l=0,r=0;
    for(int i=S-1;i>=8;i--){
        while(S-i*l>=l)l++;
        while(S-i*(r+1)>0)r++;
        if(l<=r)ans+=r-l+1;
    }
    cout<<ans%mod<<endl;

    return 0;
}