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 mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int power(int x,int y){
	if(y == 0) return 1;
	int res = power(x * x % MOD,y / 2);
	if(y & 1) res = res * x % MOD;
	return res;
}

signed main(){
	int s,ans = 0;
	cin >> s;
	for(int i = 1;i < s;i++){
		int a = s / i,b = s % i;
		if(a >= 8){
			if(!b) ans = (ans + 9 * power(10,a - 1) % MOD - i + 1 + MOD) % MOD;
			else ans = (ans + 1) % MOD;
		}
	}
	for(int i = 1;i <= 7;i++){
		for(int j = i;j <= 8;j++){
			if(i == j){
				if(s % i == 0 && s / i <= 9 * power(10,i - 1)) ans = (ans + 9 * power(10,i - 1) % MOD - s / i + 1 + MOD) % MOD;
			}
			else{
				int cnt = 0;
				for(int k = i + 1;k < j;k++) cnt += k * 9 * power(10,k - 1);
				for(int k = 1;k * i < s - cnt && k <= 9 * power(10,i - 1);k++){
					if((s - cnt - k * i) % j == 0 && (s - cnt - k * i) / j <= 9 * power(10,j - 1)){
						ans = (ans + 1) % MOD;
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}