#include<cstdio>
#include<iostream>
using namespace std;
int s,sum,digit[23000005];
long long ans,tmp=1;
inline void init(){
	for(register int i=1;i<=23000000;i++){
		digit[i]=digit[i/10]+1;
	}
}
inline long long quick_pow(long long x,int p,int m){
	long long result=1;
	while(p>0){
		if(p&1==1){
			result*=x;result%=m;
		}
		p=p>>1;
		x*=x;x%=m;
	}
	return result;
}
int main(){
	init();
	scanf("%d",&s);
	for(register int i=1;i<10000000;i++){
		while(sum<s){
			sum+=digit[tmp];
			tmp++;
		}
		if(sum==s){
			ans++;ans%=1000000007;
		}
		sum-=digit[i];
	}
	for(register int i=1;i<=s/8;i++){
		switch(s%i){
			case 0:tmp=quick_pow(10,s/i-1,1000000007)*9-i+1;
				   tmp%=1000000007;tmp=(tmp+1000000007)%1000000007;
				   ans+=tmp;ans%=1000000007;break;
			default:ans++;ans%=1000000007;break;
		}
	}
	printf("%d\n",ans);
	return 0;
}