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;
long long mod = 1000000007LL;
long long val[100001];
long long expo(long long b, int e){
    if(e==0){
        return 1LL;
    }
    if(e==1){
        return b;
    }
    if((e&1)==0){
        return expo((b*b)%mod,e/2);
    }
    else{
        long long ret = b*expo(b,e-1);
        ret %= mod;
        return ret;
    }
}
long long get(int len){
    if(len<=100000){
        return val[len];
    }
    return (expo(10LL,len-1)*9LL)%mod;
}
int main(){
    val[0] = 0LL;
    long long ten = 1LL;
    for(int i = 1; i<=100000; i++){
        val[i] = (ten*9LL)%mod;
        ten *= 10LL;
        ten %= mod;
    }
    int nxt = 1;
    int po = 0;
    int s;
    cin >> s;
    long long ans = 0LL;
    for(int i = 1;;i++){
        if(i==nxt){
            po++;
            nxt *= 10;
        }
        if(po==7){
            break;
        }
        int rem = nxt-i;
        if(po*rem>=s){
            if(s%po==0){
                ans++;
            }
        }
        else{
            int ts = s-po*rem;
            int p = po+1;
            while(val[p]*p<ts){
                ts-=val[p]*p;
                p++;
            }
            if(ts%p==0){
                ans++;
            }
        }
    }
    for(int l = 1;;l++){
        int beg = s/l;
        if(beg<7){
            break;
        }
        if(beg==7 && s%l==0){
            if(val[7]>=l){
                ans += (get(beg)-(long long)l+1LL)%mod;
                ans += mod;
                ans %= mod;
            }
        }
        else if(beg==7){
            if(val[7]>=l || val[7]*7+8*(l-val[7])<=s){
                ans++;
            }
        }
        else if(s%l==0){
            ans += (get(beg)-(long long)l+1LL)%mod;
            ans += mod;
            ans %= mod;
        }
        else{
            ans++;
        }
    }
    cout << ans << endl;
}