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>
#include <unistd.h>
#define ll long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
using namespace std;

#define int long long
const int LEN = 13888888;
const int MOD = 1e9+7;

int s, ans;

int t[18*1000*1000];

int fpow(int a, int b)
{
	if(b==0)
		return 1;

	if(b==1)
		return a%MOD;

	if(b%2)
		return (ll)a*fpow(a, b-1)%MOD;

	int q = fpow(a, b/2);
	return (ll)q*q%MOD;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	cin >> s;

	for(int len = 1; len <= min(LEN, s); ++len)
	{
		if(s%len==0)
		{
			int val = s/len, pot = fpow(10, val-1);

			if(val>8 || len<=9*pot)
			{
				ans += 9*pot-len+1;
				ans %= MOD;
			}
		}
		else
		{
			int val = s/len;
			int x = s-val*len;
			int pot = fpow(10, val-1);

			if((val>8 || len-x<=9*pot) && (val+1>8 || x<=9*10*pot))
				++ans;
		}
	}

	int curr = 1, zostalo = 9;

	for(int i = 1; i < 18*1000*1000; ++i)
	{
		t[i] = curr;
		--zostalo;

		if(!zostalo)
		{
			++curr;
			zostalo = 9*fpow(10, curr-1);
		}
	}

	int r = 0, sum = 0;

	for(int l = 1; l < 18*1000*1000; ++l)
	{
		while(sum<s && r+1<18*1000*1000)
			sum += t[++r];
	
		if(sum==s && t[r]>=t[l]+2)
			++ans;

		sum -= t[l];
	}

	ans %= MOD;
	ans += MOD;
	ans %= MOD;

	cout << ans << endl;
}