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>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;

const ll MOD=1e9+7,N=1e6,MAX_S=1e8;
ll S;
ll mpw(ll n,ll m){
	ll ret=1;
	while(m){
		if (m&1){
			ret*=n;
			ret%=MOD;
		}
		n*=n;
		n%=MOD;
		m>>=1;
	}
	return ret;
}
ll pw(ll n,ll m){
	ll ret=1;
	while(m){
		if (m&1){
			ret*=n;
		}
		n*=n;
		m>>=1;
	}
	return ret;
}	
ll dig(ll n){
	ll ret=0;
	while(n){
		ret++;
		n/=10;
	}
	return ret;
}
int main(){
	cin>>S;
	ll sqs=0;
	FOR(i,1,S+8){
		if (i*i>=S){
			sqs=i;
			break;
		}
	}
	ll ans=0;
	FOR(i,1,N){
		ll sm=0;
		ll d=dig(i);
		ll l=i;
		while(sm+d*(pw(10,d)-l)<S){
			sm+=d*(pw(10,d)-l);
			l=pw(10,d);
			d++;
		}
		if ((S-sm)%d==0){
			ans++;
			ans%=MOD;
		}
	}
	for(ll i=1;i*i<=S;i++){
		if (S%i==0){
			ll j=S/i;
			if ((i==7 && j<=9*pw(10,6)) || i>7){
				ans+=(9*mpw(10,i-1)%MOD-j+1+MOD)%MOD;
				ans%=MOD;
			}
			if (i!=j){
				if ((j==7 && i<=9*pw(10,6)) || j>7){
					ans+=(9*mpw(10,j-1)%MOD-i+1+MOD)%MOD;
					ans%=MOD;
				}
				if (j>sqs){
					ans+=MOD-1;
					ans%=MOD;
				}
			}
		}
	}		
	FOR(d,7,sqs+1){
		ll y=S%d,x=S/d-y;
		if (d==7){
			if (x>9*pw(10,6)){
				ll n=(x-9*pw(10,6)+d)/(d+1);
				x-=n*(d+1);
				y+=n*d;
			}
		}
		if (y==0){
			y+=d;
			x-=d+1;
		}
		if (x>0){
			ans+=(x-1)/(d+1)+1;
			ans%=MOD;
		}
	}
	FOR(k,1,sqs){
		ll l=max({sqs,S/(k+1),S/k-1}),r=S/k;
		ans+=max(r-l,0ll);
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}