#include <bits/stdc++.h>
using namespace std;
#define maxn 23000000
#define int long long
#define mod 1000000007
int digit[maxn], ans, S;

int read()
{
	int x = 0, k = 1;
	char c; c = getchar();
	while(c < '0' || c > '9') { if(c == '-') k = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * k;
}

int Qpow(int times)
{
	int x = 10, base = 1;
	for(; times; times >>= 1, x = x * x % mod)
		if(times & 1) base = base * x % mod;
	return base;
}

void Up(int &x, int y) { x = (x + y) % mod; }
signed main()
{
    S = read(); int lim = S / 8, now = 0;
    for(int i = 1; i < maxn; i ++) digit[i] = digit[i / 10] + 1;
    for(int i = 1, now = 0, tem = 0; i < 1e7; i ++)
    {
    	while(tem < S) { tem += digit[now]; now ++; }
		if(tem == S) { ans += 1; if(ans >= mod) ans -= mod; } 
		tem -= digit[i];
    }
    for(int i = 1; i <= lim; i ++)
	{
		if(!(S % i)) 
		{
			int l = S / i, sum = Qpow(l - 1) * 9 % mod;
			if(l < 8) continue;
			Up(ans, (sum - i + 1 + mod) % mod);
		}
		else 
		{ 
			int l = (S - S % i) / i; if(l < 8) continue;
			ans += 1; if(ans >= mod) ans -= mod; 
		}
	}
	printf("%lld\n", ans);
	return 0;
}