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;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int mod=1e9+7;
inline void add(int &x,int y){
	x+=y;
	x=(x>=mod?x-mod:x);
}
int Pw[10];
inline int ksm(int x,int y){
	int res=1;
	while(y){
		if(y&1) res=(ll)res*x%mod;
		x=(ll)x*x%mod;
		y>>=1;
	}
	return res;
}
int main(){
	int n=read();
	int ans=0;
	Pw[0]=1;
	REP(i,1,8) Pw[i]=Pw[i-1]*10;
	for(int i=1,j=1,di=1,dj=1,Nw=1;j<1e7;){
		while(Nw>n){
			Nw-=dj;
			++j;
			if(j==Pw[dj]) ++dj;
		}
		if(j>=1e7) break;
		if(Nw==n) ++ans;
		++i;
		if(i==Pw[di]) ++di;
		Nw+=di;
	}
	for(int i=1;(ll)i*i<=n;++i) if(n%i==0){
		if(i>=8){
			int u=(ksm(10,i)-ksm(10,i-1)+mod)%mod;
			u=(u-n/i+1+mod)%mod;
			add(ans,u);
		}
		if(n!=i*i && n/i>=8){
			int u=(ksm(10,n/i)-ksm(10,n/i-1)+mod)%mod;
			u=(u-i+1+mod)%mod;
			add(ans,u);
		}
	}
	REP(i,1,n){
		if((n-1)/i<8) break;
		add(ans,max((n-1)/i-max(n/i-1,7),0));
	}
	printf("%d\n",ans);
	return 0;
}