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 MAXN=3e6+5;
const int MAXM=1e5+5;
const int mod=1e9+7;

LL s,num[20],sum[20];
int len,factor[MAXN];

void update(LL &a,LL b){
	a+=b;
	if (a>mod) a-=mod;
}

LL gcd(LL a,LL b){
	if (b==0) return a;
	else return gcd(b,a%b);
}

void exgcd(LL a,LL b,LL &x,LL &y){
	if (b==0){x=1; y=0;}
    else{exgcd(b,a%b,y,x); y-=x*(a/b);}
}

LL power(LL a,LL b){
	LL c=1;
	while(b){
		if (b%2==1) c=(c*a)%mod;
		a=(a*a)%mod;
		b/=2;
	}
	return c;
}

void prepare(){
	num[0]=sum[0]=0;
	num[1]=sum[1]=9;
	for(int i=2;i<=15;i++){
		num[i]=num[i-1]*10;
		sum[i]=sum[i-1]+num[i]*i;		
	}
	len=0;
	for(LL i=1;i*i<=s;i++){
		if (s%i!=0) continue;
		factor[++len]=i;
		if (i*i!=s) factor[++len]=s/i;
	}
}

LL calc(int l,int r,LL c){
    c-=(sum[r-1]-sum[l]);
    if (c<0 || c>num[r]*r+num[l]*l) return 0;
    
    LL a=l,b=r,d=gcd(a,b);
	if (c%d!=0) return 0;

	c/=d; a/=d; b/=d;
	LL x,y; exgcd(a,b,x,y);

	LL llim,rlim;

	if ((c*x)%b==0) llim=(-c*x/b+1);
	else llim=(LL)ceil(-1.0*c*x/b);            
	llim=max(llim,(LL)ceil(1.0*(c*y-num[r])/a));    
            
	if ((c*y)%a==0) rlim=c*y/a-1;
	else rlim=(LL)floor(1.0*c*y/a);
	rlim=min(rlim,(LL)floor(1.0*(num[l]-c*x)/b));
            
	if (llim>rlim) return 0;
	else return (rlim-llim+1)%mod;
}

int main(){
	scanf("%lld",&s);
	prepare();
	LL ans=0;
	for(int i=1;i<=12;i++){	
		for(int j=i+1;j<=12;j++){
			update(ans,calc(i,j,s));
		}
	}
	//std::cout<<ans<<std::endl;
	for(int i=1;i<12;i++){
		if (s%i!=0) continue;
        if (num[i]*i<s) continue;
		LL cnt=((num[i]-s/i+1)%mod+mod)%mod;
		//cout<<i<<' '<<cnt<<endl;
		update(ans,cnt);
	}
	//cout<<ans<<endl;
	update(ans,(s/12)%mod);
	int kkk=0;
	for(int i=1;i<=len;i++){
		if (factor[i]>s/12) continue;		
		update(ans,(power(10,s/factor[i]-1)*9)%mod),kkk++;
		update(ans,mod-factor[i]);
		//cout<<factor[i]<<endl;
	}
	//cout<<kkk<<endl;
	if (s==0) ans=0;
	printf("%lld\n",ans);
    return 0;
}