Problem: For a positive integer n, let us define f(n) as the number of digits in base 10.

You are given an integer S. Count the number of the pairs of positive integers (l, r) (l \leq r) such that f(l) + f(l + 1) + ... + f(r) = S, and find the count modulo 10^9 + 7.

Constraints

* 1 \leq S \leq 10^8

Input

Input is given from Standard Input in the following format:


S


Output

Print the answer.

Examples

Input

1


Output

9


Input

2


Output

98


Input

123


Output

460191684


Input

36018


Output

966522825


Input

1000


Output

184984484

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll mod = 1e9+7;

ll n, ans, ten[15] = {1}, sum[15];

ll calc (ll X) {
	if(X <= 10) return ten[X] % mod;
	ll R = calc(X/2);
	R = R * R % mod;
	if(X&1) R = R * 10 % mod;
	return R;
}

int main()
{
	scanf("%lld",&n);
	for(ll i=1;i<=16;i++) {
		ten[i] = ten[i-1] * 10;
	}
	for(ll i=1;i<=n;i++) {
		ll X = n/i, Y = n%i;
		if(X < 10 && i >= ten[X+1]) break;
		if(X < 10 && (i-Y > ten[X]-ten[X-1] || Y > ten[X+1]-ten[X])) continue;
		if(Y) ans = (ans + 1) % mod;
		else ans = (ans + calc(X) + mod - calc(X-1) + 1 + mod - i) % mod;
	}
	for(ll i=2;i<10;i++) {
		sum[i] = (ten[i] - ten[i-1]) * i;
	}
	for(ll i=2;;i++) {
		if(sum[i] > n) break;
		ll X;
		for(ll j=1;j<=ten[i-1]-ten[i-2];j++) {
			X = j * (i-1);
			for(ll k=i;;k++) {
				X += sum[k];
				if(X >= n) break;
				if((n-X)%(k+1)==0 && (n-X)/(k+1) <= ten[k+1]-ten[k]) ans++;
			}
		}
		ans %= mod;
	}
	printf("%lld\n",ans);
}