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;
typedef long long lint;
typedef pair<int, int> pi;
const int MAXN = 20000001;
const int mod = 1e9 + 7;

int f[MAXN];

lint ipow(int x, int p){
	lint ret = 1, piv = x;
	while(p){
		if(p & 1) ret = ret * piv % mod;
		piv = piv * piv % mod;
		p >>= 1;
	}
	return ret;
}

int occupy(int l, int c){
	if(l >= 9) return (9ll * ipow(10, l - 1) - c + mod + 1) % mod;
	if(l <= 7) return 0;
	if(l == 8){
		int s = max(20000001, 10000000 + c - 1);
		int e = 99999999;
		return max(e - s + 1, 0);
	}
}

int occupiable(int l, int c){
	if(l >= 9) return true;
	if(l <= 7) return false;
	if(l == 8) return c > 10000001 && c <= 90000000;
}

int main(){
	for(auto &i : {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000}) f[i]++;
	for(int i=1; i<MAXN; i++) f[i] += f[i-1];
	int s; cin >> s;
	int ptr = 0, sum = 0;
	lint ret = 0;
	for(int i=1; i<MAXN; i++){
		sum += f[i];
		while(sum > s){
			sum -= f[++ptr];
		}
		if(sum == s) ret++;
	}
	for(int i=1; i<=s; i++){
		int lv = s / i, rv = s / i + 1;
		int lc = i - s % i, rc = s % i;
		if(rc == 0){
			ret += occupy(lv, lc);
		}
		else{
			ret += occupiable(rv, rc);
		}
	}
	cout << ret % mod << endl;
}