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 <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>

using LL = long long;
LL powers[18];
const int MOD = (int)1e9 + 7;

const int kThreshold = 8;

int power(int a, int b, int p)
{
    int ret = 1;
    for ( ; b; b >>= 1, a = a * 1LL * a % MOD)
        if (b & 1)
            ret = ret * 1LL * a % MOD;
    return ret;
}

inline void add(int &a, int b)
{
    a += b;
    if (a >= MOD) a -= MOD;
}

int main()
{
    powers[0] = 1;
    for (int i = 1; i < 18; ++ i) powers[i] = powers[i - 1] * 10;
    int S;
    scanf("%d", &S);
    int result = 0;
    int left = 1, right = 0, sum = 0, left_id = 1, right_id = 1;
    for ( ; left < powers[kThreshold - 1]; ++ left) {
        while (sum < S) {
            if (++ right == powers[right_id])
                ++ right_id;
            sum += right_id;
        }
        if (sum == S)
            ++ result;
        if (left == powers[left_id])
            ++ left_id;
        sum -= left_id;
    }
    auto N = [](int d) {
        return ((power(10, d, MOD) - power(10, d - 1, MOD)) % MOD + MOD) % MOD;
    };
    add(result, S / kThreshold);
    for (int t = 1; t <= S / kThreshold; ++ t) if (S % t == 0) {
        add(result, (N(S / t) - t + MOD) % MOD);
    }
    printf("%d\n", result);
}