#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll maxx(ll a,ll b) {
	return a>b?a:b;;
}
void print(int x) {
	if(x>9) print(x/10);
	putchar(x%10+48);
}
int yzh=1e9+7,s,f[25500000+5];
int quick_pow(int a, int b) {
	int ans=1;
	while(b) {
		if(b&1) ans=1ll*ans*a%yzh;
		a=1ll*a*a%yzh,b>>=1;
	}
	return ans;
}
int count1(int n) {
	int ans = 0, r = 0, cnt = 0;
	for (int i = 1; i < 10000000; i++) {
		cnt -= f[i-1];
		while (cnt+f[r+1] <= s && r < 25500000) cnt += f[++r];
		if (cnt == s) ++ans;
		if (r == 25500000) break;
	}
	return ans;
}
int count2(int n) {
	int lim = n/8, ans = lim;
	for (int t = 1; t <= lim; t++) if (n%t == 0) {
			int len = n/t;
			(ans += (1ll*quick_pow(10, len-1)*9%yzh-t)%yzh) %= yzh;
	}
	return ans;
}
int main() {
	for (int i = 1, r = 10, cnt = 1; i < 10000000; i++, i = r, r = r*10, cnt++) for (int j = i; j < r; j++) f[j] = cnt;
	for (int i = 10000000; i <= 25500000; i++) f[i] = 8;
	cin>>s;
	if (((count1(s)+count2(s))%yzh+yzh)%yzh < 0) cout<<"-";
	print(maxx(((count1(s)+count2(s))%yzh+yzh)%yzh,-((count1(s)+count2(s))%yzh+yzh)%yzh));
	return 0;
}
### Prompt

Create a solution in cpp for 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 <bits/stdc++.h>
#define ll long long
using namespace std;
ll maxx(ll a,ll b) {
	return a>b?a:b;;
}
void print(int x) {
	if(x>9) print(x/10);
	putchar(x%10+48);
}
int yzh=1e9+7,s,f[25500000+5];
int quick_pow(int a, int b) {
	int ans=1;
	while(b) {
		if(b&1) ans=1ll*ans*a%yzh;
		a=1ll*a*a%yzh,b>>=1;
	}
	return ans;
}
int count1(int n) {
	int ans = 0, r = 0, cnt = 0;
	for (int i = 1; i < 10000000; i++) {
		cnt -= f[i-1];
		while (cnt+f[r+1] <= s && r < 25500000) cnt += f[++r];
		if (cnt == s) ++ans;
		if (r == 25500000) break;
	}
	return ans;
}
int count2(int n) {
	int lim = n/8, ans = lim;
	for (int t = 1; t <= lim; t++) if (n%t == 0) {
			int len = n/t;
			(ans += (1ll*quick_pow(10, len-1)*9%yzh-t)%yzh) %= yzh;
	}
	return ans;
}
int main() {
	for (int i = 1, r = 10, cnt = 1; i < 10000000; i++, i = r, r = r*10, cnt++) for (int j = i; j < r; j++) f[j] = cnt;
	for (int i = 10000000; i <= 25500000; i++) f[i] = 8;
	cin>>s;
	if (((count1(s)+count2(s))%yzh+yzh)%yzh < 0) cout<<"-";
	print(maxx(((count1(s)+count2(s))%yzh+yzh)%yzh,-((count1(s)+count2(s))%yzh+yzh)%yzh));
	return 0;
}
```