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 int long long
const int mod=1e9+7;
int binpow(int a, int b) 
{
	int res=1;
	while(b)
	{
		if(b&1)	res=res*a%mod;
		a=a*a%mod;
		b/=2;	
	}
    return res;
}
signed main() {
    int n;
    cin>>n;
    // run l from 1 to 1e7
    int l=1;
    int r=1;
    int cur=1;
    int ans=0;
    while(l<1e7) {
        if(cur==n) {
            //cout<<l<<" "<<r<<endl;
            ans=(ans+1)%mod;
        }
        if(cur<=n) {
            r++;
            cur+=(int)log10(r)+1; // digit of r
        }
        if(cur>n) {
            l++;
            cur-=((int)log10(l-1)+1);
        }
    }
    //cout<<"ans = "<<ans<<endl;
    for(int dig=8 ; dig<=n ; dig++) {
        if(n%dig==0) {
            // can use all dig-digit numbers
            int cnt=n/dig;
            int up=binpow(10,dig);
            int down=binpow(10,dig-1);
            int add=(up-cnt+1)-down;
            //cout<<"digit = "<<dig<<endl;
            //cout<<"add = "<<add<<endl;
            ans=(ans+add+mod)%mod;
        }
        // dig*a+(dig+1)*b=n
        // => (dig)(a+b)=n-b
        // b%(dig)==(n)%(dig)
        int rem=(n%dig);
        if(!rem) rem=dig;
        int low=rem*(dig+1);
        int hi=dig*(dig+1); // n>dig*a because b must >0
        if(low<n) ans=(ans+(n-low-1)/hi+1)%mod;
    }
    cout<<ans;
}