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;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const Int MOD = 1000000007;
Int divup(Int x, Int y) { return (x+y-1)/y; }
Int more(int S) {
    vector<char> A(2e7);
    int t = 1, k = 0;
    for (int i = 0; i < A.size(); i++) {
        if (i == t) k++, t *= 10;
        A[i] = k;
    }
    int i = 1, j = 1, sum = 0;
    Int ans = 0;
    while (A[i] <= 6) {
        while (sum < S) { sum += A[j]; j++; }
        if (A[i] + 1 < A[j - 1] && sum == S) ans++;
        sum -= A[i];
        i++;
    }
    return ans;
}
Int two(int S) {
    Int ans = 0;
    for (Int i = 1; i + (i+1) <= S; i++) {
        // i * (-S+(i+1)*n) + (i+1) * (S-i*n) == S
        Int nmin = 0, nmax = INT_MAX;
        // -S+(i+1)*n >= 1
        nmin = max(nmin, divup(1 + S, i+1));
        // S-i*n >= 1
        nmax = min(nmax, (S - 1) / i);
        if (i <= 7) {
            Int k = 9*(Int)pow(10, i-1);
            // -S+(i+1)*n <= 9*10^(i-1)
            nmax = min(nmax, (k+S)/(i+1));
            // S-i*n <= 9*10^i
            nmin = max(nmin, divup(S-k*10, i));
        }
        ans += max(0LL, nmax - nmin + 1);
        ans %= MOD;
    }
    return ans;
}
Int one(int S) {
    Int ans = 0;
    Int nine = 9; // 9 * 10^(i-1) mod MOD
    for (int i = 1; i <= S; i++, nine = (nine * 10) % MOD) {
        if (S % i != 0) continue;
        if (i <= 8 && S / i > nine) continue;
        ans = (ans + nine + MOD - (S / i) + 1) % MOD;
    }
    return ans;
}
int main() {
    int S; cin >> S;
    cout << (one(S) + two(S) + more(S)) % MOD << endl;
    return 0;
}