#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const LL mod = 1e9 + 7;
LL S;
int d[10];

LL pw(LL x , LL y){
	LL res = 1;
	LL z = x;
	for(LL i = y ; i > 0 ; i >>= 1){
		if(i&1) (res *= z) %= mod;
		z = z * z % mod;
	}
	return res;
}

int main(){
	cin >> S;
	LL ans = 0;
	int j = 1;
	int x = 1 , y = 1;
	LL z = 0;
	d[0] = 1;
	repp(i,0,9) d[i+1] = d[i] * 10;
	repp(i,1,1e7){
		if(i == d[x]) ++x;
		while(z < S){
			z += y;
			++j;
			if(j == d[y]) ++y;
		}
		if(z == S) ++ans;
		z -= x;
	}
	for(LL i = 1 ; i * i <= S ; ++i){
		if(S%i) continue;
		if(i >= 8) (ans += 9 * pw(10,i-1) - S/i + 1) %= mod;
		if(S/i >= 8 && i * i < S) (ans += 9 * pw(10,S/i-1) - i + 1) %= mod;
	}
	repp(i,8,S/2+1) (ans += (S-1)/i - (S+i+1)/(i+1) + 1) %= mod;
	if(ans<0) ans += mod;
	cout << ans << endl;
	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>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const LL mod = 1e9 + 7;
LL S;
int d[10];

LL pw(LL x , LL y){
	LL res = 1;
	LL z = x;
	for(LL i = y ; i > 0 ; i >>= 1){
		if(i&1) (res *= z) %= mod;
		z = z * z % mod;
	}
	return res;
}

int main(){
	cin >> S;
	LL ans = 0;
	int j = 1;
	int x = 1 , y = 1;
	LL z = 0;
	d[0] = 1;
	repp(i,0,9) d[i+1] = d[i] * 10;
	repp(i,1,1e7){
		if(i == d[x]) ++x;
		while(z < S){
			z += y;
			++j;
			if(j == d[y]) ++y;
		}
		if(z == S) ++ans;
		z -= x;
	}
	for(LL i = 1 ; i * i <= S ; ++i){
		if(S%i) continue;
		if(i >= 8) (ans += 9 * pw(10,i-1) - S/i + 1) %= mod;
		if(S/i >= 8 && i * i < S) (ans += 9 * pw(10,S/i-1) - i + 1) %= mod;
	}
	repp(i,8,S/2+1) (ans += (S-1)/i - (S+i+1)/(i+1) + 1) %= mod;
	if(ans<0) ans += mod;
	cout << ans << endl;
	return 0;
}

```