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;
#define rep(i,l,r) for(int i=l;i<=r;++i)
const int D=1e9+7;
ll mi(ll x,int y)
{
	ll ans=1;
	while(y)
	{
		if(y&1)ans=ans*x%D;
		x=x*x%D;y>>=1;
	}
	return ans;
}

int n;
namespace Count1
{
ll ans;
void check(int k)
{
	if(k<8)return ;
	ans+=mi(10,k)-mi(10,k-1)-n/k+1;
}
ll main()
{
	int g=sqrt(n);
	rep(i,1,g)
	if(n%i==0)
	{
		check(i);
		if(n/i!=i)check(n/i);
	}
	return ans%D;
}
};

namespace Count2
{
ll f(int i,int n)
{
	ll ans=0;
	while(i<=n)
	{
		int j=n/(n/i);
		ans+=(ll)(n/i)*(j-i+1);
		i=j+1;
	}
	return ans%D;
}
ll main()
{
	return f(8,n-1)-f(9,n);
}
};

int main()
{
	//freopen("1.in","r",stdin);
	cin>>n;
	if(n<=8)
	{
		int l=1,cl=1,wl=10;
		int r=1,cr=1,wr=10;
		int s=0,ans=0;
		while(cl<n)
		{
			while(s<n)
			{
				s+=cr;
				++r;
				if(r==wr){wr*=10;++cr;}
			}
			if(s==n)++ans;
			s-=cl;
			++l;
			if(l==wl){wl*=10;++cl;}
		}
		ans+=wl-wl/10;
		cout<<ans<<endl;
		return 0;
	}
	int l=1,cl=1,wl=10;
	int r=1,cr=1,wr=10;
	int s=0,ans=0;
	while(cl<8)
	{
		while(s<n)
		{
			s+=cr;
			++r;
			if(r==wr){wr*=10;++cr;}
		}
		if(s==n)++ans;
		s-=cl;
		++l;
		if(l==wl){wl*=10;++cl;}
	}
	cout<< ((ans+Count1::main()+Count2::main())%D+D)%D <<endl;
}