#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_st=(a);i>=i##_st;--i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define dbg(x) cerr<<#x" = "<<x<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define Es(x,i) for(Edge *i=G[x];i;i=i->nxt)
typedef long long ll;
typedef pair<int,int> pii;
const int inf=~0u>>1,MOD=1e9+7;
inline int rd() {
    int x,c,f=1;while(!isdigit(c=getchar()))f=c!='-';x=c-'0';
    while(isdigit(c=getchar()))x=x*10+c-'0';return f?x:-x;
}
const int N=10000000;
int f[N];
inline int pw(int n,int m){
	int r=1;
	for(;m;m>>=1,n=(ll)n*n%MOD)
		if(m&1)r=(ll)r*n%MOD;
	return r;
}
int main(){
#ifdef flukehn
	freopen("test.txt","r",stdin);
#endif 
	For(i,1,N)f[i]=f[i/10]+1;
	For(i,1,N)f[i]+=f[i-1];
	int l=0,n=rd();
	ll ans=0;
	For(i,1,N){
		while(f[i]-f[l]>n)++l;
		ans+=(f[i]-f[l]==n);
		if(f[N-1]-f[i-1]<n){
			int t=n-f[N-1]+f[i-1];
			if(!(t&7))++ans;
		}
	}
//	cerr<<ans<<endl;
	rep(i,1,n/8){
		if(n%i==0){
			int t=n/i;
			ll tmp=pw(10,t)-pw(10,t-1);
			ans+=tmp-i+1;
		}else{
			++ans;
		}
	}
	ans=(ans%MOD+MOD)%MOD;
	cout<<ans<<endl;
}