#include <bits/stdc++.h>

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_p(x) cerr<<#x": "<<x.first<<","<<x.second<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define DMAX 
#define NMAX 
#define MMAX 
#define MOD 1000000007

using namespace std;

long long n, k, x, v[103000100];
string s;


template<class T>
ostream& operator<<(ostream& out, vector<T> v)
{
	out << v.size() << '\n';
	for(auto e : v)
		out << e << ' ';
	return out;
}

long long pw(long long base, long long exp) {
	if(exp == 1) return base;
	if(exp == 0) return 1LL;

	long long g = pw(base, exp / 2);
	g = g * g;
	g %= MOD;
	if(exp % 2) return (g * base) % MOD;
	else return g;
}

inline long long nrc(long long k) {
	long long ans = 0;
	while(k) ans++, k/=10;
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	// for(long long i = 1; i < 100000000; i++)

	cin >> n;
	long long ans = 0;
	long long j = 1, sum = 0, p10 = 9;
	// 
	// ans = n / 8;
	for(int t = 1; t <= n / 8; t++) {
		if(n % t == 0) {
			long long nr = n / t;
			long long g = (long long)((pw(10, nr) - pw(10, nr - 1) + MOD) % MOD + MOD - t + 1) % MOD;
			// if(g < 0) g += MOD;
			ans += g;
			ans %= MOD;
		} 
		else ans++;
	}
	ans %= MOD;
	// dbg(ans);
	// dbg(ans);
	for(int i = 0; i < 10; i++) 
		v[i] = 1;
	
	for(long long i = 10; i < 23000000; i++)
		v[i] = v[i / 10] + 1;

	for(long long l = 1, r = 2, sum = v[1]; l < 10000000;sum -= v[l], l++) {
		while(sum < n) sum += v[r], r++;
		if(sum == n) {
			// dbg(l);
			// dbg(r);
			ans ++;
		}
	}

	cout << ans % MOD << '\n';
} 
### Prompt

Please provide a CPP coded solution to the problem described below:

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 <bits/stdc++.h>

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_p(x) cerr<<#x": "<<x.first<<","<<x.second<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define DMAX 
#define NMAX 
#define MMAX 
#define MOD 1000000007

using namespace std;

long long n, k, x, v[103000100];
string s;


template<class T>
ostream& operator<<(ostream& out, vector<T> v)
{
	out << v.size() << '\n';
	for(auto e : v)
		out << e << ' ';
	return out;
}

long long pw(long long base, long long exp) {
	if(exp == 1) return base;
	if(exp == 0) return 1LL;

	long long g = pw(base, exp / 2);
	g = g * g;
	g %= MOD;
	if(exp % 2) return (g * base) % MOD;
	else return g;
}

inline long long nrc(long long k) {
	long long ans = 0;
	while(k) ans++, k/=10;
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	// for(long long i = 1; i < 100000000; i++)

	cin >> n;
	long long ans = 0;
	long long j = 1, sum = 0, p10 = 9;
	// 
	// ans = n / 8;
	for(int t = 1; t <= n / 8; t++) {
		if(n % t == 0) {
			long long nr = n / t;
			long long g = (long long)((pw(10, nr) - pw(10, nr - 1) + MOD) % MOD + MOD - t + 1) % MOD;
			// if(g < 0) g += MOD;
			ans += g;
			ans %= MOD;
		} 
		else ans++;
	}
	ans %= MOD;
	// dbg(ans);
	// dbg(ans);
	for(int i = 0; i < 10; i++) 
		v[i] = 1;
	
	for(long long i = 10; i < 23000000; i++)
		v[i] = v[i / 10] + 1;

	for(long long l = 1, r = 2, sum = v[1]; l < 10000000;sum -= v[l], l++) {
		while(sum < n) sum += v[r], r++;
		if(sum == n) {
			// dbg(l);
			// dbg(r);
			ans ++;
		}
	}

	cout << ans % MOD << '\n';
} 
```