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>
#include<cstring>

const int MOD=1000000007;
inline void inc(int a,int &b){b=(a+b)%MOD;}

typedef long long ll;
ll qpow(ll a,ll b){ll c=1;for(;b;b>>=1,a=a*a%MOD)if(b&1)c=c*a%MOD;return c;}

ll Num[16];
void GetNum(){Num[1]=9;for(int i=2;i<=15;i++)Num[i]=Num[i-1]*10;}

namespace Worker
{
	ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
	void exgcd(ll a,ll b,ll &x,ll &y){b?exgcd(b,a%b,y,x),y-=x*(a/b):(x=1,y=0);}
	int calc(ll a0,ll a1,ll b0,ll b1,ll x,ll y,ll c)
	{
		ll d=gcd(x,y);
		if(c%d!=0)return 0;
		x/=d,y/=d,c/=d;

		ll oa,ob,L,R;
		exgcd(x,y,oa,ob),oa*=c,ob*=c;

		a0-=oa,a1-=oa,b0=ob-b0,b1=ob-b1;

		L=std::max(a0/y+(a0>0)*(a0%y!=0),b1/x+(b1>0)*(b1%x!=0));
		R=std::min(b0/x-(b0<0)*(b0%x!=0),a1/y-(a1<0)*(a1%y!=0));

		return (L<=R?R-L+1:0)%MOD;
	}
}

namespace Zhidao
{
	const int lim=12;
	ll S;

	int calc(int L,int R)
	{
		ll tmp=0;
		for(int i=L+1;i<R;i++)
			tmp+=Num[i]*i;

		int ret=Worker::calc(1,Num[L],1,Num[R],L,R,S-tmp);

		return ret;
	}

	int calc_p(ll p)
	{
		if(S%p!=0)return 0;
		ll len=S/p;
		if(len>Num[p])return 0;
		return (Num[p]-len+1)%MOD;
	}

	int calc_d(ll len)
	{
		if(len>S/lim)return 1;
		ll p=S/len,num=(qpow(10,p)-qpow(10,p-1))%MOD;
		return (num-len+1)%MOD;
	}

	void solve()
	{
		scanf("%lld",&S);
		int ans=0;
		for(int i=1;i<=lim;i++)
			for(int j=i+1;j<=lim;j++)
				inc(calc(i,j),ans);

		for(int i=1;i<lim;i++)
			inc(calc_p(i),ans);

		inc((S/lim)%MOD,ans);
		
		for(ll i=1;i*i<=S;i++)
			if(S%i==0)
			{
				inc(calc_d(i)-1,ans);
				if(S/i!=i)inc(calc_d(S/i)-1,ans);
			}
		ans=(ans+MOD)%MOD;
		printf("%d\n",ans);
	}
}

int main()
{
	GetNum();
	Zhidao::solve();
	return 0;
}