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;

int S;
long long MOD = 1000000007;

int f(long long x)
{
    if (x >= 10000000) return 8;
    else if (x >= 1000000) return 7;
    else if (x >= 100000) return 6;
    else if (x >= 10000) return 5;
    else if (x >= 1000) return 4;
    else if (x >= 100) return 3;
    else if (x >= 10) return 2;
    else return 1;    
}

int main()
{
    cin >> S;
    long long ans = 0;

    int begin = 1;
    int end = 1;
    int sum = 0;
    while (begin < 10000000)
    {
        if (sum == S)
        {
            ans++;
            sum = sum + f(end) - f(begin);
            end++;
            begin++;
        }
        else if (sum < S)
        {
            sum += f(end);
            end++;
        }
        else
        {
            sum -= f(begin);
            begin++;
        }
    }

    for (int i = S/8; i > 0; i--)
    {
        long long decmem = 1, adecmem = 0;
        if (S % i == 0)
        {
            int power = S / i - 1 - adecmem;

            long long tmp;
            for (int j = 1; j <= 30; j++)
            {
                if (j==1) tmp = 10;
                else tmp = tmp * tmp % MOD;
                if (power >> (j-1) & 1) decmem = decmem * tmp % MOD;
            }
            adecmem = S / i - 1;
            ans += (9 * decmem - i + 1 + MOD) % MOD;
            ans %= MOD;
        }
        else
        {
            ans = (ans + 1) % MOD;
        }
    }

    cout << ans << endl;
    return 0;
}