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>
#pragma GCC optimize("Ofast")
#define mod 1000000007
using namespace std;
inline int read()
{int x=0,f=0;
char c=getchar();
while (c<'0'||c>'9') 
{if (c=='-') f=1;
c=getchar();
}
while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
if (f) x=-x;
return x;
}
int s,p[11];
int bel[25];
bool vis[200000005];
int main (){
	int i,ans=0,now=0,tp=1;
	scanf ("%d",&s);vis[0]=1;
	for (i=1;i<=25000000;i++)
	{now+=tp;vis[now]=1;
	if (tp>=2&&now-s<bel[tp-2]&&now>=s&&vis[now-s]) ans++;
	if (i==9||i==99||i==999||i==9999||i==99999||i==999999||i==9999999)
	{bel[tp]=now;tp++;}
	}
	p[0]=1;
	for (i=1;i<=9;i++)
	{p[i]=p[i-1]*10;}
	for (i=1;i<=8;i++)
	{int al=s/i,rm=s%i,n1=al-rm,n2=rm;
	if (n2==0) {n1-=(i+1);n2+=i;}
	if (n1<=0) continue;
	int mz=p[i]-p[i-1],mr=p[i+1]-p[i];
	if (n1>mz)
	{n1-=((n1-mz)/(i+1))*(i+1);
	while (n1>mz) n1-=(i+1);
	}
	if (n1<=0) continue;
	n2=(s-i*n1)/(i+1);
	if (n2>mr) continue;
	int o=min((n1-1)/(i+1)+1,(mr-n2)/i+1);
	ans+=o;
	if (ans>=mod) ans-=mod;
	}
	for (i=9;i<=s;i++)
	{int al=s/i,rm=s%i,n1=al-rm,n2=rm;
	if (n2==0) {n1-=(i+1);n2+=i;}
	if (n1<=0) continue;
	ans+=(n1-1)/(i+1)+1;
	if (ans>=mod) ans-=mod;
	}
	tp=9;
	for (i=1;i<=8;i++)
	{if (s%i) {tp=1ll*tp*10%mod;continue;}
	int o=s/i;
	if (o<=tp) {ans+=(tp-o+1);}
	if (ans>=mod) ans-=mod;
	tp=1ll*tp*10%mod;
	}
	for (i=9;i<=s;i++)
	{if (s%i) {tp=1ll*tp*10%mod;continue;}
	int o=s/i;
	ans+=(tp-o+1);
	if (ans>=mod) ans-=mod;
	if (ans<0) ans+=mod;
	tp=1ll*tp*10%mod;
	}
	printf ("%d\n",ans);
	return 0;
}