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:
#ifndef LOCAL
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

const ll MOD = 1e9 + 7;
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}

const int MX = 1e7;

ll s;
ll ans = 0;

ll get(ll x) {
	ll lb = 1;
	ll rb = 9;
	ll ans = 0;
	for (int i = 1; lb <= x; ++i, lb *= 10, rb = rb * 10 + 9) {
		ans += (min(x, rb) - lb + 1) * i;
	}
	return ans;
}

int get2(ll x) {
	int cnt = 0;
	while (x)
		x /= 10, ++cnt;
	return cnt;
}

int main() {
	cin >> s;
	//s = ll(1e8);
	vector<int> vv;
	for (int i = 1; i * i <= s; ++i)
		if (s % i == 0) {
			vv.push_back(i);
			if (i * i != s)
				vv.push_back(s / i);
		}
	sort(vv.begin(), vv.end());
	for (int i: vv) {
		if (i < 8)
			continue;
		ll go = 9 * pw(10, i - 1) % MOD;
		ans = (ans + go - (s / i)) % MOD;
	}
	ans = (ans + s / 8) % MOD;
	ll lb = 1;
	ll rb = ll(1e8);
	while (rb - lb > 1) {
		ll mid = (lb + rb) >> 1;
		if (get(mid) <= s)
			lb = mid;
		else
			rb = mid;
	}
	ll cur = get(lb);
	ll now = lb;
	for (int i = 1; i < MX; ++i) {
		while (cur < s)
			++now, cur += get2(now);
		if (cur == s)
			++ans;
		cur -= get2(i);
	}
	ans %= MOD;
	cout << ans << "\n";
	return 0;
}