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 <algorithm>
#include <cstring>
#define LL long long
using namespace std;

const int lim1=10000000;
const int lim2=22500000;
const int p=1e9+7;
int n;
int f[lim2+5];

void pre(){
	int L=1,R=10;
	for(int len=1;len<=7;++len){
		for(int i=L;i<R;++i) f[i]=len;
		L*=10;
		R*=10;
	}
	for(int i=lim1;i<=lim2;++i) f[i]=8;
}

LL cale1(){
	LL ret=0;
	LL L=1,R=1;
	int cnt=0;
	while(1){
		while(R<=lim2&&cnt<n) cnt+=f[R++];
		if(cnt<n) break;
		if(cnt==n) (ret+=1)%=p;
		cnt-=f[L++];
		if(L>=lim1) break;
	}
	return ret;
}

LL exp(LL a,LL b){
	LL ret=1,k=a;
	while(b){
		if(b&1) (ret*=k)%=p;
		b>>=1;
		(k*=k)%=p;
	}
	return ret;
}

LL cale2(){
	int lim = n/8, ans = lim;
    for (int t = 1; t <= lim; t++)
    if (n%t == 0) {
        int len = n/t;
        (ans += (1ll*exp(10, len-1)*9%p-t)%p) %= p;
    }
    return ans;
}

int main(){
	scanf("%d",&n);
	pre();
	LL ans=(cale1()+cale2())%p;
	cout<<ans;
	return 0;
}