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>
#define mo 1000000007
using namespace std;
int f[23333333];
int d,ans;
int power(int x,int y){
	int s=1;
	for (;y;y/=2,x=1ll*x*x%mo)
		if (y&1) s=1ll*s*x%mo;
	return s;
}
void work(int v){
	if (v<8) return;
	int tmp=(power(10,v)+mo-power(10,v-1))%mo;
	tmp=(tmp+mo-d/v+1)%mo;
	ans=(ans+tmp)%mo;
}
int main(){
	scanf("%d",&d);
	int rrange=23333331;
	for (int i=1;i<=rrange;i++)
		f[i]=f[i/10]+1;
	for (int i=1;i<=rrange;i++)
		f[i]+=f[i-1];
	for (int i=1,r=0;i<=rrange;i++){
		for (;f[i]-f[r]>d;r++);
		if (r>=9999999) break;
		ans+=(f[i]-f[r]==d);
	}
	for (int i=1;i*i<=d;i++)
		if (d%i==0){
			work(i);
			if (i*i!=d) work(d/i);
		}
	for (int i=8;i<=d;i++){
		int tmp=d%i;
		tmp=(tmp==0?i+1:tmp);
		if (d/i<=tmp) continue;
		int now=d/i-tmp;
		ans=(ans+(now-1)/(i+1)+1)%mo; 
	}
	printf("%d",ans);
}