#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

#define MOD 1000000007

long long mod_pow(long long a,long long b)
{
    a %= MOD;
    long long res = 1;
    while(b){
        if(b & 1){
            res = res * a % MOD;
        }
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}


ll a[10000000];

int main(){
    int s;
    cin >> s;
    int lll = 1;
    int dd = 1;
    while(lll<10000000){
        for(int i=lll;i<10*lll;i++){
            a[i] = a[i-1]+dd;
        }
        lll*=10;
        dd++;
    }
    ll res = 0;
    int id = 0;
    for(int i=1;i<=9999999;i++){
        if(s>68888889-a[i-1]){
            if((s-68888889+a[i-1])%8==0){
                res++;
            }
        }else{
            while(id<9999999&&a[id]<s+a[i-1]){
                id++;
            }
            if(a[id]==s+a[i-1]){
                res++;
            }
        }
    }
    for(ll len=8;len<=s;len++){
        if(len==s/2+5){
            len = s-1;
        }
        if(s%len==0){
            ll p = s/len;
            //cerr << len << " " << (9*mod_pow(10,len-1)+mod-p+1)%mod << " " << p << " " << (p-1)/(len+1) << endl;
            res += 9*mod_pow(10,len-1)+mod-p+1;
            res %= mod;
            res += (p-1)/(len+1);
            res %= mod;
        }else{
            ll p,q;
            q = s%len;
            p = (s-q*(len+1))/len;
            if(p<=0)continue;
            //cerr << len << " " << p << " " << q << " " << (p-1)/(len+1)+1 << endl;
            res += (p-1)/(len+1)+1;
            res %= mod;
        }
    }
    cout << res << endl;
    return 0;
}
### Prompt

Please formulate a cpp solution to 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 <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

#define MOD 1000000007

long long mod_pow(long long a,long long b)
{
    a %= MOD;
    long long res = 1;
    while(b){
        if(b & 1){
            res = res * a % MOD;
        }
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}


ll a[10000000];

int main(){
    int s;
    cin >> s;
    int lll = 1;
    int dd = 1;
    while(lll<10000000){
        for(int i=lll;i<10*lll;i++){
            a[i] = a[i-1]+dd;
        }
        lll*=10;
        dd++;
    }
    ll res = 0;
    int id = 0;
    for(int i=1;i<=9999999;i++){
        if(s>68888889-a[i-1]){
            if((s-68888889+a[i-1])%8==0){
                res++;
            }
        }else{
            while(id<9999999&&a[id]<s+a[i-1]){
                id++;
            }
            if(a[id]==s+a[i-1]){
                res++;
            }
        }
    }
    for(ll len=8;len<=s;len++){
        if(len==s/2+5){
            len = s-1;
        }
        if(s%len==0){
            ll p = s/len;
            //cerr << len << " " << (9*mod_pow(10,len-1)+mod-p+1)%mod << " " << p << " " << (p-1)/(len+1) << endl;
            res += 9*mod_pow(10,len-1)+mod-p+1;
            res %= mod;
            res += (p-1)/(len+1);
            res %= mod;
        }else{
            ll p,q;
            q = s%len;
            p = (s-q*(len+1))/len;
            if(p<=0)continue;
            //cerr << len << " " << p << " " << q << " " << (p-1)/(len+1)+1 << endl;
            res += (p-1)/(len+1)+1;
            res %= mod;
        }
    }
    cout << res << endl;
    return 0;
}
```