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 ll;
const int N=1e7+10,p=1e9+7;
int inc(int x,int y){x+=y;return x>=p?x-p:x;}
int dec(int x,int y){x-=y;return x<0?x+p:x;}
int mul(int x,int y){return (ll)x*y%p;}
int power(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=mul(x,x))
		if (y&1) ans=mul(ans,x);
	return ans;
}
int S,bits[N];ll sum[10];
//(10^(n-1)-1)/9*80+9+(n-1)*10^n
int calc(int p){
	if (p<=7) return 0;
	int l=S/p;
	return dec(mul(9,power(10,p-1)),l-1);
}
int calc(int L,int S){
	int ans=0;
	for (int l=L,r;l<=S;l=r+1){
		r=S/(S/l);
		ans=inc(ans,mul(r-l+1,S/l));
	}
	return ans;
}
int main()
{
	cin>>S;
	for (ll i=1,p=10;i<10;i++,p*=10) sum[i]=(8*p-80)/9+(i-1)*p+9;
	int ans=0;
	for (int i=1;i<=1e7;i++) bits[i]=bits[i/10]+1;
	//枚举l<10^7
	for (int l=0,s=0;l<9999999;l++,s+=bits[l]){		
		ll v=S+s;int p=1;
		while (v>sum[p]) p++;
		if ((v-sum[p-1])%p==0) ans++;
	}
	for (int i=1;i*i<=S;i++)
	if (S%i==0){
		ans=inc(ans,calc(i));
		if (S!=i*i) ans=inc(ans,calc(S/i));
	}
	//两段
	ans=inc(ans,calc(8,S-1));
	ans=dec(ans,calc(9,S));
	cout<<ans<<endl;
	return 0;
}