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>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
using namespace std;
typedef long long LL;

const int maxn = 9999999, MOD = 1000000007;
int f[maxn*3+1], S, ans, l, r, mn, mx;

inline void inc(int &a, int b) {
	a += b; if (a >= MOD) a -= MOD;
}
inline void dec(int &a, int b) {
	a -= b; if (a < 0) a += MOD;
}
inline int mul(int a, int b) {
	return 1LL * a * b % MOD;
}
inline int power(int x, int p) {
	int res = 1;
	while (p) {
		if (p & 1) res = 1LL * res * x % MOD;
		p >>= 1; x = 1LL * x * x % MOD;
	}
	return res;
}
inline void work(int k) {
	if (k <= 7) return;
	int res = mul(9, power(10, k-1));
	dec(res, S/k-1); inc(ans, res);
}

int main() {
	scanf("%lld", &S);
	rep (i, 1, maxn*3) f[i] = f[i/10] + 1;
	rep (i, 1, maxn*3) inc(f[i], f[i-1]);
	for (int l=0,r=1; r<=maxn*3; r++) {
		while (f[r] - f[l] > S) l++;
		if (l >= maxn) break;
		if (f[r] - f[l] == S) ans++;
	}
	for (int i=1; i*i<=S; i++) if (S % i == 0) {
		work(i); if (i*i != S) work(S/i);
	}
	for (int i=8; i<=S; i++) {
		mn = S / i - S % i; mx = S / i;
		if (mn > i + 1) mn %= i + 1;
		if (mn <= 0) mn += i + 1;
		if (S % i == 0) mx--;
		if (mx < mn) continue;
		inc(ans, (mx - mn) / (i + 1) + 1);
	}
	printf("%d\n", ans);
	return 0;
}