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<cstdio>
#include<algorithm>
using namespace std;
const int MOD=1e9+7;
struct mint{int x;mint(int x=0):x(x){}};
inline mint operator+  (mint a,mint b){return a.x+b.x<MOD?a.x+b.x:a.x+b.x-MOD;}
inline mint operator-  (mint a){return MOD-a.x;}
inline mint operator-  (mint a,mint b){return a+-b;}
inline mint operator*  (mint a,mint b){return 1LL*a.x*b.x%MOD;}
inline mint operator<< (mint x,int y){mint r=1;for(;y;y>>=1,x=x*x)if(y&1)r=r*x;return r;}
inline mint operator~  (mint x){return x<<MOD-2;}
inline mint operator/  (mint a,mint b){return a*~b;}
inline mint&operator+= (mint&a,mint b){return a=a+b;}
inline mint&operator-= (mint&a,mint b){return a=a-b;}
inline mint&operator*= (mint&a,mint b){return a=a*b;}
inline mint&operator<<=(mint&x,int y){return x=x<<y;}
inline mint&operator/= (mint&a,mint b){return a=a/b;}
mint ans;int f[9];
void cal(int n,int x)
	{if(x>8||f[x]>=n/x)ans+=9*(mint(10)<<x-1)-n/x+1;}
int main()
{
	int n,x,i,j,k;
	for(f[1]=9,i=2;i<9;++i)f[i]=f[i-1]*10;
	scanf("%d",&n);
	for(i=1;i*i<n;++i)if(n%i==0)cal(n,i),cal(n,n/i);
	if(i*i==n)cal(n,i);
	for(i=1;i<8;++i)ans+=max(0,min((n-1)/i,(f[i]+n)/(i+1))-max(n/(i+1)+1,(n-f[i+1]+i-1)/i)+1);
	for(;i*2<n;++i)ans+=max(0,(n-1)/i-n/(i+1));
	for(i=1;i<7;++i)for(x=n,j=i;++j;)
	{
		if(j>i+1)for(k=max(1,(x-j*f[j]+i-1)/i);k<=f[i]&&i*k<x;++k)if((x-i*k)%j==0)ans+=1;
		if((x-=j*9*(mint(10)<<j-1).x)<0)break;
	}
	printf("%d",ans);
}