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 M 10001000
#define MOD 1000000007
#define rep(i, x, y) for(int i = (x); i <= (y); ++ i)
#define F(x) (x >= 10000000 ? 8 : f[x])
int f[M];
inline int Power(int x) {
	int ret = 1, t = 10;
	while(x) {
		if(x & 1) ret = 1ll * ret * t % MOD;
		x >>= 1; t = 1ll * t * t % MOD;
	}
	return ret;
}
#define num(x) (9ll * Power(x - 1) % MOD)
int main() {
	//freopen("in.txt", "r", stdin);
	int S; cin >> S;
	f[1] = 1; f[10] = 2; f[100] = 3; f[1000000] = 7;
	f[1000] = 4; f[10000] = 5; f[100000] = 6; f[10000000] = 8;
	rep(i, 1, 1e7) {
		if(!f[i]) f[i] = f[i - 1];
	}
	int r = 0, t = 0;
	int res = 0;
	rep(i, 1, (1e7) - 1) {
		r = max(r, i - 1);
		while(t + F(r + 1) <= S) ++ r, t += F(r);
		if(t == S) ++ res;
		t -= F(i);
		if(t < 0) t = 0;
	}
	rep(i, 8, S) {
		int w = S / i;
		int yu = S - w * i;
		if(w <= yu) continue;
		int a = w - yu;
		res += a / (i + 1) + (a % (i + 1) == 0 ? 0 : 1);
		if(res >= MOD) res -= MOD;
		if(yu == 0) res += MOD - 1;
		if(res >= MOD) res -= MOD;
	}
	for(int i = 1; i * i <= S; ++ i) {
		if(S % i != 0) continue;
		int x;
		if(i >= 8) {
			x = S / i;
			res += (num(i) - x + 1 + MOD) % MOD;
			if(res >= MOD) res -= MOD;	
		}
		if(S / i < 8 || i == S / i) continue;
		x = i;
		res += (num(S / i) - x + 1 + MOD) % MOD;
		if(res >= MOD) res -= MOD;
	}
	printf("%d\n", res);
	return 0;
}