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>

const int p=1000000007;

int i,n,l,r,s,t,w;

inline int calc(int x)
{
	if (x<10) return 1;
	if (x<100) return 2;
	if (x<1000) return 3;
	if (x<10000) return 4;
	if (x<100000) return 5;
	if (x<1000000) return 6;
	if (x<10000000) return 7;
	return 8;
}

inline int power(int x,int y)
{
	int s=1;
	for (int i=30;i>=0;i--)
	{
		s=1LL*s*s%p;
		if ((1<<i)&y)
			s=1LL*s*x%p;
	}
	return s;
}

int main()
{
	scanf("%d",&n);
	for (i=8;i<=n;i++)
	{
		if (! (n%i))
			s=(s+9LL*power(10,i-1)-(n/i)%p+p)%p;
		if (n>=1LL*(n%i)*(i+1))
			s=(s+((n-(n%i)*(i+1))/i+i)/(i+1))%p;
	}
	t=0;
	for (l=1,r=1;calc(l)<=7;l++)
	{
		for (;t<n;r++)
			t=t+calc(r);
		if (t==n)
			s++;
		t=t-calc(l);
	}
	printf("%d",s%p);
	return 0;
}