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>
#define lsb(x) (x & (-x))
#define ll long long
// 82

using namespace std;

const int MOD = (int) 1e9 + 7;
const int MAXN = (int) 1e5;

ll sp[100];
int p10[MAXN + 1];

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1)
            ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, s, d;
    ios::sync_with_stdio(false);
    cin >> s;
    p10[0] = 1;
    for(i = 1; i <= MAXN; i++) {
        p10[i] = (1LL * p10[i - 1] * 10) % MOD;
    }
    for(i = 1; i <= 15; i++) {
        sp[i] = sp[i - 1] + 1LL * i * 9 * p10[i - 1];
    }
    int ans = 0;
    for(d = 1; d * d <= s; d++) {
        if(s % d == 0) {
            if(s / d <= 1LL * 9 * p10[d - 1] || d > 9) {
                ans = (ans + 1LL * 9 * p10[d - 1] - s / d + 1) % MOD;
            }
            if(d * d < s) {
                int a = lgput(10, s / d - 1);
                if(d <= 1LL * 9 * a || s / d > 9) {
                     ans = (ans + 1LL * 9 * a - d + 1) % MOD;
                }
            }
        }
    }
    for(i = 1; i <= 7; i++) {
        int dim = 9 * p10[i - 1];
        int sum = 0;
        for(int j = 1; j <= dim && sum + i < s; j++) {
            sum += i;
            int rez = 0;
            for(int pas = 1 << 5; pas; pas >>= 1) {
                if(rez + pas <= 8 && sp[rez + pas] - sp[i] + sum <= s)
                    rez += pas;
            }
            if((s - sum - (sp[rez] - sp[i])) % (rez + 1) == 0) {
                ans++;
            }
        }
    }
    for(i = 1; i <= s / 8; i++) {
        if(s % i)
            ans++;
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}