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;

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int main(){
    int S;
    cin >> S;
    const int MX = 1e8;
    int s = 0, r = 1, ld = 1, llim = 10, rd = 1, rlim = 10;
    int64_t ans = 0;

    for(int l=1; l<MX; l++){
        if(l == llim){
            ld++;
            llim *= 10;
        }
        while(s < S){
            s += rd;
            r++;
            if(r == rlim){
                rd++;
                rlim *= 10;
            }
        }
        if(s == S) ans++;
        s -= ld;
    }

    for(int i=1; i*i<=S; i++) if(S%i == 0){
        vector<int> ds;
        if(i > 8) ds.push_back(i);
        if(S/i > 8 && i < S/i) ds.push_back(S/i);
        for(int d : ds){
            int64_t len = S/d;
            int64_t total = 9 * power_mod(10, d-1) % MOD;
            add(ans, total - len + 1 + MOD);
        }
    }

    for(int x=9; 2*x<S; x++){
        int64_t lmin = (x+1) * (S/(x+1) + 1) - S;
        int64_t rmin = S - x * (S%x ? S/x : S/x-1);
        int64_t lmax = (S - (x+1)*rmin) / x;
        if(lmin <= lmax) add(ans, (lmax - lmin) / (x+1) + 1);
    }

    cout << ans << endl;
    return 0;
}