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:
#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#include<bits/stdc++.h>
#define int ll
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
const int maxn = 1<<20, mod = 1e9 + 7;
ll S, ans = 0;
inline int LOG(int x) {
	return x < 10000 ?
	(x < 100 ? 1+(x>9) : 3+(x>999)) :
	(x < 1000000 ? 5+(x>99999) : 7+(x>9999999)+(x>99999999));
}
int bp(int a, int p) {
	int r = 1;
	while(p) {
		if(p&1) r = r*1ll*a%mod;
		a = a*1ll*a%mod, p>>=1;
	}
	return r;
}
signed main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> S;
	int l = 1;
	for(int cur = 0, i = 1;; i++) {
		cur += LOG(i);
		while(cur > S) cur -= LOG(l++);
		if(l >= 100000000) {break;}
		ans += cur==S;
	}
	//cout << ans << '\n';
	for(int ml = 9; ml <= S; ml++) {
		ll u = (S-1)/(ml+1);
		u -= S%ml;
		if(u >= 0) ans = (ans + (u/ml) + 1);
		if(S%ml == 0) {
			int no = bp(10, ml) - bp(10, ml-1);
			if(no < 0) no += mod;
			ans = (mod + ans + no - (S/ml))%mod;
		}
		//cout << ml << " " << ans << '\n';
	}
	cout << ans << '\n';
}