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<iostream>
#include<cstdio>
#define mod 1000000007
using namespace std;
int n,num,p[35],c[35],ans;
inline void R(int&x,int y){(x+=y)>=mod?x-=mod:0;}
inline int pow(int x,int k)
{
	int sum=1;
	for(;k;k>>=1,x=1LL*x*x%mod) if(k&1) sum=1LL*sum*x%mod;
	return sum;
}
void dfs(int x,int v)
{
	if(x>num)
	{
		int num=9LL*pow(10,v-1)%mod;
		if(v<=9&&num<n/v); else R(ans,((num-(n/v)+1)%mod+mod)%mod);
		return;
	}	
	for(int i=0;i<=c[x];++i) dfs(x+1,v),v*=p[x];
}
int exgcd(int a,int b,int&x,int&y)
{
	if(!b){x=1;y=0;return a;}
	int c=exgcd(b,a%b,y,x);
	y-=a/b*x;return c;
}
inline int D(int x,int y){return (x+1000000000LL*y)/y-1000000000;}
inline int U(int x,int y){return (x+1000000000LL*y+y-1)/y-1000000000;}
int Solve(int a,int b,int c,int ux,int uy)
{
	int x,y,g=exgcd(a,b,x,y);
	if(c%g) return 0;
	x*=c/g;y*=c/g;a/=g;b/=g;
	int t=x/b;x-=t*b;y+=t*a;
	if(x<=0)
	{
		int t=(-x)/b+1;
		x+=t*b;y-=t*a;	
	}
	int l=max(0,U(y-uy,a)),r=min((ux-x)/b,D(y-1,a));
	if(l<=r) return r-l+1; else return 0;
}
int main()
{
	scanf("%d",&n);int t=n;
	for(int i=2;i<=10000;++i) if(t%i==0)
	{
		p[++num]=i;
		while(t%i==0) t/=i,++c[num];
	}
	if(t>1) p[++num]=t,c[num]=1;dfs(1,1);
	for(int l=1;l<10;++l)
		for(int r=l+1,mid=0;r<10&&mid+l+r<=n;mid=min(mid+9LL*r*pow(10,r-1),(long long)1e9),++r)
			R(ans,Solve(l,r,n-mid,9*pow(10,l-1),9*pow(10,r-1)));
	for(int i=9,last;i<=n;i=last+1)
	{
		last=n/(n/i);
		if(1LL*i*i<=n)
		{
			int A=n/i,B=n%i;//l=0,r=n,mid,res=0;
		/*	while(l<=r)
			{
				mid=l+r>>1;
				if(A-mid>B+1LL*mid*i) res=mid,l=mid+1;
				else r=mid-1;
			}*/
		//	A-res>B+res*i
		//	A-B>res*(i+1)
			R(ans,(A-B-1)/(i+1)-(B==0)+1);
		}
		else if(n%(n/i)) R(ans,1);
	}
	cout<<ans;
	return 0;
}