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:
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define sd(x) scanf("%d", &(x))
#define F first
#define S second

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

#else
#define trace(...)
#endif

const int mod = 1e9 + 7;
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
	int x = 1 % mod;
	while(b){
		if(b & 1) x = mul(x, a);
		a = mul(a, a);
		b >>= 1;
	}
	return x;
}

inline int inv(int a){ return powr(a, mod - 2);}

ll pw10[20];

inline int get(int d, int S){
	if(d <= 8) return 0;
	int l = S / d;
	if(d >= 10 || l <= pw10[d] - pw10[d - 1]){
		return add(1, sub(sub(powr(10, d), powr(10, d - 1)), l));
	}
	return 0;
}
const int M = 1e9 + 10;
bitset<M> bs;
int main(){
	pw10[0] = 1;
	for(int i = 1; i < 20; i++){
		pw10[i] = pw10[i - 1] * 10;
	}
	int S;
	cin >> S;
	int ans = 0;
	for(int i = 1; i * i <= S; i++){
		if(S % i == 0){
			int d = i;
			ans = add(ans, get(d, S));
			if(i * i != S){
				d = S / i;
				ans = add(ans, get(d, S));
			}
		}
	}

	for(int i = 8; 2 * i + 1 <= S; i++){
		// b = S(mod i)
		int mnb = S % i;
		if(mnb == 0) mnb += i;

		for(ll b = mnb; b * 1ll * (i + 1) + i <= S; b += i){
			ans++;
		}
		if(ans >= mod) ans %= mod;
	}
	int p = 0;
	for(int d = 1; d <= 8; d++){
		for(int v = pw10[d - 1]; v < pw10[d]; v++){
			p += d;
			bs.set(p);
		}
	}
	p = 0;
	if(bs[S]) ans++;
	ans %= mod;
	for(int d = 1; d <= 8; d++){
		for(int v = pw10[d - 1]; v < pw10[d]; v++){
			p += d;
			if(bs[p + S]) ans++;
		}
	}
	if(bs[p + S]) ans = add(ans, mod - 1);
	ans %= mod;
	cout << ans;
}