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>

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

void update(int& x, int a)
{
    x += a;
    if (x >= MOD) {
        x -= MOD;
    }
}

int pow(int n)
{
    int result = 1, a = 10;
    while (n) {
        if (n & 1) {
            result = 1LL * result * a % MOD;
        }
        a = 1LL * a * a % MOD;
        n >>= 1;
    }
    return result;
}

int main()
{
    int s;
    scanf("%d", &s);
    int result = s / 8, tmp = s, j = 1, len_j = 1, nxt_j = 10;
    while (true) {
        if (j == nxt_j) {
            len_j ++, nxt_j *= 10;
        }
        if (len_j > tmp) {
            break;
        }
        tmp -= len_j, j ++;
    }
    for (int i = 1, len_i = 1, nxt_i = 10; i < 10000000; ++ i) {
        while (len_j <= tmp) {
            tmp -= len_j, j ++;
            if (j == nxt_j) {
                len_j ++, nxt_j *= 10;
            }
        }
        if (tmp == 0) {
            result ++;
        }
        if (i == nxt_i) {
            len_i ++, nxt_i *= 10;
        }
        tmp += len_i;
    }
    auto check = [&](int d) {
        if (d * 8 <= s) {
            update(result, pow(s / d));
            update(result, MOD - pow(s / d- 1));
            update(result, MOD - d);
        }
    };
    for (int d = 1; d * d <= s; ++ d) {
        if (s % d == 0) {
            check(d);
            if (d * d != s) {
                check(s / d);
            }
        }
    }
    printf("%d\n", result);
}