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 rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

ll s;
bool ok[6000000];
int _div, si;

void init() {
    int num = 9000000;
    int i = 7;
    while (num * i >= s) {
        num /= 10;
        i--;
    }
    _div = i;
    si = num;
    num /= 10;
    i--;
    int pos = 0;
    for ( ; i >= 1; i--) {
        for (int j = 0; j < num; j++) {
            pos += i;
            ok[pos] = true;
        }
        num /= 10;
    }
}

ll mod_pow(ll x, ll y) {
    ll ret = 1;
    while (y) {
        if (y&1) ret = ret * x % MOD;
        x = x * x % MOD;
        y /= 2;
    }
    return ret;
}

ll rnk(ll x, ll y) {
    return (mod_pow(10LL, x)-mod_pow(10LL, x-1)-y+1+3*MOD)%MOD;
}

ll ans = 0;

int main(){
    cin >> s;
    init();
    for (int i = 1; i*i <= s; i++) {
        if (s%i == 0) {
            if (i > _div) {
                ans = (ans + rnk(i, s/i) - 1 + MOD)%MOD;
            }
            if (i*i == s) continue;
            int j = s/i;
            if (j > _div) {
                ans = (ans + rnk(j, s/j) -1 + MOD)%MOD;
            }
        }
    }
    ans += s / (_div+1);
    for (int i = 1; i <= si; i++) {
        if ((s-i*_div)%(_div+1) == 0) {
            ans++;
        }
    }
    for (int i = 0; i < 6000000; i++) {
        if (!ok[i]) continue;
        int tmp = s-i;
        if (tmp <= _div*si) {
            if (tmp%_div == 0) ans++;
        } else {
            if ((tmp-_div*si)%(_div+1) == 0) ans++;
        }
    }
    cout << ans%MOD << endl;
}