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 VS
#include<bits/stdc++.h>
#endif

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

LL S;
LL ret = 0;
constexpr int mod = 1e9 + 7;
constexpr int ten8 = 1e8;
inline void inc(int &id, int &nxt, LL &len, LL& sum) {
	id++;
	if (id == nxt) {
		len++;
		nxt *= 10;
	}
	sum += len;
}
int main() {
	cin >> S;
	{
		int l = 0, r = 0;
		int lnxt = 10, rnxt = 10;
		LL llen = 1, rlen = 1;
		LL lsum = 0, rsum = 0;
		while (l < ten8-1) {
			while (rsum - lsum < S)inc(r, rnxt,rlen, rsum);
			if (rsum - lsum == S)ret++;
			inc(l,lnxt, llen, lsum);
		}
	}
	LL p = 10;
	LL q = 1;
	LL len = 1;
	for (int _ : range(1,S)) {
		int num = S - _;
		LL llen = S / num;
		if (llen <= 8)continue;
		if (S%num == 0) {
			while (len < llen) {
				len++; 
				p = p * 10 % mod;
				q = q * 10 % mod;
			}
			ret += p + mod + mod - num - q + 1;
			ret %= mod;
		}
		else {
			ret++;
		}
	}
	cout << ret%mod << endl;
	return 0;
}