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

long long getDigit(int u){
    int res = 0;
    while(u!=0){
        u /= 10, res++;
    }
    return res;
}

long long getCount(int l,int r,int left,int mod){
    if(l%mod<=left) l = l-l%mod+left;
    else l = l-l%mod+left+mod;
    if(l>r) return 0;
    else return (r-l+mod)/mod;
}

long long power(long long a,long long b){ 
    long long res = 1;
    while(b){
        if(b&1) res = res*a%mod;
        a = a*a%mod;
        b /= 2;
    }
    return res;
}

int main(){
    long long n;
    scanf("%lld",&n);
    long long sum = 0, nextSum = 0;
    int p = 0;
    int upper = (1e7)-2;
    long long ans = 0;
    for(int i = 0; i <= upper; i++){
        sum += getDigit(i);
        while(nextSum-sum<n){
            p++;
            nextSum += getDigit(p);
        } 
        if(nextSum-sum==n) ans++; 
    }
    for(long long i = 1; i*i<=n; i++){
        if(n%i==0){
            int j = n/i;
            if(i>=8){
                long long add = 9ll*power(10,i-1)%mod;
                add -= (j-1); if(add<0) add += mod;
                ans += add; if(ans>=mod) ans -= mod;
            }
            if(j!=i && j>=8){
                long long add = 9ll*power(10,j-1)%mod;
                add -= (i-1); if(add<0) add += mod;
                ans += add; if(ans>=mod) ans -= mod;
            }
        }
    }
    //this part...
    for(int i = 8; i <= n; i++){
        long long j = i+1;
        long long left = (long long)(-n)%j;
        if(left<0) left += j;
        int maxn = n/i;
        if(n%i==0) maxn--; 
        long long add = getCount(1,maxn,left,j);
        //printf("i = %d, add = %lld\n",i,add);
        ans += add; if(ans>=mod) ans -= mod;
    }
    printf("%lld\n",ans);
    return 0;
}