#include <bits/stdc++.h>
using namespace std;

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

i64 mod_pow(i64 x, i64 y, i64 mod){
    i64 res=1;
    while(y){
        if(y&1) res=res*x%mod;
        x=x*x%mod;
        y>>=1;
    }
    return res;
}

void solve(){
    i64 S;
    cin >> S;

    i64 mod=1000000007,ans=0,r=1,ld=0,rd=1,nl=1,nr=10,sum=1;
    rep(l,1,100000000){
        sum-=ld;
        if(l==nl){
            nl*=10;
            ++ld;
        }
        while(sum<S){
            ++r;
            if(r==nr){
                nr*=10;
                ++rd;
            }
            sum+=rd;
        }
        if(sum==S) ++ans;
    }

    rep(d,1,S+1){
        if(S/d<=8) continue;
        if(S%d==0){
            i64 tmp=(9*mod_pow(10,S/d-1,mod)-d+1+mod)%mod;
            ans+=tmp;
            ans%=mod;
        }else{
            ++ans;
            ans%=mod;
        }
    }

    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

### Prompt

Create a solution in CPP for the following 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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

i64 mod_pow(i64 x, i64 y, i64 mod){
    i64 res=1;
    while(y){
        if(y&1) res=res*x%mod;
        x=x*x%mod;
        y>>=1;
    }
    return res;
}

void solve(){
    i64 S;
    cin >> S;

    i64 mod=1000000007,ans=0,r=1,ld=0,rd=1,nl=1,nr=10,sum=1;
    rep(l,1,100000000){
        sum-=ld;
        if(l==nl){
            nl*=10;
            ++ld;
        }
        while(sum<S){
            ++r;
            if(r==nr){
                nr*=10;
                ++rd;
            }
            sum+=rd;
        }
        if(sum==S) ++ans;
    }

    rep(d,1,S+1){
        if(S/d<=8) continue;
        if(S%d==0){
            i64 tmp=(9*mod_pow(10,S/d-1,mod)-d+1+mod)%mod;
            ans+=tmp;
            ans%=mod;
        }else{
            ++ans;
            ans%=mod;
        }
    }

    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

```