#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#define r register
typedef long long ll;
const int mod=1e9+7;
const int maxn=23000000;
inline ll qpow(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1)res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res%mod;
}
inline int read(){
	register int x=0,f=1;register char ch=getchar();
	for(;!isdigit(ch);f=ch=='-'?-1:1,ch=getchar());
	for(;isdigit(ch);x=(x<<3)+(x<<1)+(ch^48),ch=getchar());
	return x*f;
}
int buf[15];
inline void write(int x){
	register int cnt=0;
	while(x)buf[++cnt]=x%10+48,x/=10;
	while(cnt)putchar(buf[cnt--]);
	puts("");
}
int base[maxn];
int main(){
    r int n=read(),ans=0;
	for(r int i=1;i<=maxn;i++)base[i]=base[i/10]+1;
    for(r int i=1,j=1,s=0;i<1e7;i++){
        while(s<n)s+=base[j++];
        if(s==n)ans=(ans+1)%mod;
        s-=base[i];
    }
    for(int i=1;i<=(n>>3);i++){
        if(n%i)ans=(ans+1)%mod;
        else ans=(ans+(qpow(10,n/i)-qpow(10,n/i-1)-i+1+mod)%mod)%mod;
    }
    write(ans);
    return 0;  
}