#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

llint s;

llint keta(llint x)
{
	llint ret = 0;
	for(;x;x/=10) ret++;
	return ret;
}

llint pow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (pow(a, n-1)%mod)) % mod;
	}
	else{
		return pow((a*a)%mod, n/2) % mod;
	}
}

int main(void)
{
	cin >> s;
	llint l, r = 0, sum = 0;
	
	llint ans = 0;
	for(l = 1; l <= 1e6; l++){
		sum -= keta(l-1);
		for(; sum < s; r++, sum += keta(r));
		if(keta(r) - keta(l) < 2) continue;
		if(sum == s) ans++, ans %= mod;
	}
	
	llint ub = s;
	//if(keta(l) > 1) ub = min(s, (s+keta(l)-2) / (keta(l)-1));
	llint num[] = {0, 9, 90, 900, 9000, 90000, 900000, 9000000, 90000000, 900000000};
	for(llint i = 1; i <= ub; i++){
		llint q = s / i, r = s % i;
		if(r){
			if((q > 9 || num[q] >= i-r) && (q+1 > 9 || num[q+1] >= r) ) ans++, ans %= mod;
		}
		else{
			if(q > 9 || num[q] >= i){
				llint cnt = (9 * pow(10, q-1) + (mod-i) + 1) % mod;
				//cout << q << " " << cnt << endl;
				ans += cnt, ans %= mod;
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}
### Prompt

Generate a CPP solution to the following 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

### Response

```cpp
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

llint s;

llint keta(llint x)
{
	llint ret = 0;
	for(;x;x/=10) ret++;
	return ret;
}

llint pow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (pow(a, n-1)%mod)) % mod;
	}
	else{
		return pow((a*a)%mod, n/2) % mod;
	}
}

int main(void)
{
	cin >> s;
	llint l, r = 0, sum = 0;
	
	llint ans = 0;
	for(l = 1; l <= 1e6; l++){
		sum -= keta(l-1);
		for(; sum < s; r++, sum += keta(r));
		if(keta(r) - keta(l) < 2) continue;
		if(sum == s) ans++, ans %= mod;
	}
	
	llint ub = s;
	//if(keta(l) > 1) ub = min(s, (s+keta(l)-2) / (keta(l)-1));
	llint num[] = {0, 9, 90, 900, 9000, 90000, 900000, 9000000, 90000000, 900000000};
	for(llint i = 1; i <= ub; i++){
		llint q = s / i, r = s % i;
		if(r){
			if((q > 9 || num[q] >= i-r) && (q+1 > 9 || num[q+1] >= r) ) ans++, ans %= mod;
		}
		else{
			if(q > 9 || num[q] >= i){
				llint cnt = (9 * pow(10, q-1) + (mod-i) + 1) % mod;
				//cout << q << " " << cnt << endl;
				ans += cnt, ans %= mod;
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}
```