#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int MAXN = 20000001;
const int mod = 1e9 + 7;

int f[MAXN];

lint ipow(int x, int p){
	lint ret = 1, piv = x;
	while(p){
		if(p & 1) ret = ret * piv % mod;
		piv = piv * piv % mod;
		p >>= 1;
	}
	return ret;
}

int occupy(int l, int c){
	if(l >= 9) return (9ll * ipow(10, l - 1) - c + mod + 1) % mod;
	if(l <= 7) return 0;
	if(l == 8){
		int s = max(20000001, 10000000 + c - 1);
		int e = 99999999;
		return max(e - s + 1, 0);
	}
}

int occupiable(int l, int c){
	if(l >= 9) return true;
	if(l <= 7) return false;
	if(l == 8) return c > 10000001 && c <= 90000000;
}

int main(){
	for(auto &i : {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000}) f[i]++;
	for(int i=1; i<MAXN; i++) f[i] += f[i-1];
	int s; cin >> s;
	int ptr = 0, sum = 0;
	lint ret = 0;
	for(int i=1; i<MAXN; i++){
		sum += f[i];
		while(sum > s){
			sum -= f[++ptr];
		}
		if(sum == s) ret++;
	}
	for(int i=1; i<=s; i++){
		int lv = s / i, rv = s / i + 1;
		int lc = i - s % i, rc = s % i;
		if(rc == 0){
			ret += occupy(lv, lc);
		}
		else{
			ret += occupiable(rv, rc);
		}
	}
	cout << ret % mod << endl;
}
