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 <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;

typedef long long ll;

int s;
ll ans;
const ll MOD = 1e9 + 7;

int lg(int x)
{
    if (x < 10) return 1;
    if (1000 < x && x < 10000) return 4;
    return lg(x / 10) + 1;
}

ll inq(ll x, ll y)
{
    if (!y) return 1;
    ll l = inq(x, y / 2);
    if (y % 2) return l * l % MOD * x % MOD;
    return l * l % MOD;
}

signed main()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    cin >> s;
    int r = 1, si = 0;
    for (int l = 1; l < 10000000; l++)
    {
        while (si + lg(r) <= s) si += lg(r), r++;
        if (si == s) ans++;
        si -= lg(l);
    }
    for (int fl = 8; fl <= s; fl++)
    {
        if (s % fl == 0)
        {
            ans = (ans + 4 * MOD + inq(10, fl) - inq(10, fl - 1) - s / fl + 1) % MOD;
        }
        int r = s % fl;
        if (r == 0) r += fl;
        ll val = r * (fl + 1);
        ll c = 1ll * fl * (fl + 1);
        if (val < s) ans = (ans + (s - val) / c + ((s - val) % c > 0)) % MOD;
    }
    cout << ans % MOD;
}