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 <cassert>
#include <iostream>

using namespace std;

const int pows[] = {1, 10, 100, 1000, 10000, 100000, 1000000,
                    10000000, 100000000, 1000000000};

const int MOD = 1000000007;
const int THRESHOLD = 8;

int main() {
    ios::sync_with_stdio(false);

    int S;
    cin >> S;

    int start = 1, end = 2;
    int s_idx = 1, e_idx = 1;
    
    long long sum = 1;
    long long ans = 0;
    
    while (start < pows[THRESHOLD-1]) {
        while (sum < S) {
            sum += e_idx;
            end++;
            if (end == pows[e_idx])
                e_idx++;
        }
        
        if (sum == S)
            ans++;
        
        sum -= s_idx;
        start++;
        if (start == pows[s_idx])
            s_idx++;
    }

    long long num = 9LL * pows[THRESHOLD-1];
    
    for (int digits = THRESHOLD; digits <= S; digits++) {
        // All f(x) = digits

        if (S % digits == 0) {
            int select = S/digits;
            ans += num - select + 1;
            ans = (ans % MOD + MOD) % MOD;
        }        
        num = num * 10 % MOD;

        // Some f(x) = digits and some f(x) = digits+1
        // k * digits + l * (digits+1) = S
        // => k = (S - l * (digits+1)) / digits
        
        int ell = S % digits;
        if (ell == 0)
            ell = digits;
        
        long long val = S - (long long)ell*(digits+1);
        assert(val % digits == 0);

        if (val > 0) {
            ans += 1 + (val-1)/(digits*(long long)(digits+1));
            if (ans >= MOD)
                ans -= MOD;
        }
    }

    cout << ans << endl;
}