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 ll long long
const ll mod=1e9+7;

int S,r;
ll sum,ans;
int f[25000000];

ll power(ll x,ll y) {
	ll ret=1;
	for (;y;y>>=1,x=x*x%mod)
		if (y&1) ret=ret*x%mod;
	return ret;
}

inline void add(ll &x,ll y) {x=(x+y)%mod;}

ll cal(int x) {
	return 9*power(10,x-1)-S/x+1;
}

int main()
{
	scanf("%d",&S);
	for (int i=1;i<=23000000;i++) f[i]=f[i/10]+1;
	for (int i=1;i<10000000;i++) {
		while (sum<S) sum+=f[++r];
		if (sum==S) ans++;
		sum-=f[i];
	}
	for (int i=1;i<=sqrt(S);i++)
		if (S%i==0) {
			if (i>=8)add(ans,cal(i));
			if (i*i!=S && S/i>=8) add(ans,cal(S/i));
		}
	add(ans,S/8);
	for (int i=1;i<=S/8;i++) if (S%i==0) ans--;
	printf("%lld\n",(ans%mod+mod)%mod);
	return 0;
}