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 <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#define P 1000000007

using namespace std;

typedef long long ll;

ll powmod(ll x, ll y = P - 2, ll p = P) {
    ll ans = 1;
    while(y) {
        if(y & 1) ans = ans * x % p;
        x = x * x % p;
        y >>= 1;
    }
    return ans;
}

const int m10[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};

int S, K[30000010];

ll Solve1(int x) {
    int tmp = S / x;
    if(x <= 8 && tmp > m10[x] - m10[x - 1]) return 0;
    return powmod(10, x) - powmod(10, x - 1) - tmp + 1;
}

void add(ll &x, ll y) {
    x = (x + y) % P;
}

int main() {
    scanf("%d", &S);
    ll ans = 0;
    for(int i = 1; i <= sqrt(S); i++) if(S % i == 0) {
        add(ans, Solve1(i));
        if(i * i != S) add(ans, Solve1(S / i));
    }
    for(int i = S; i >= 1; i--) {
        int tmp = S / i;
        int s = S % i;
        if(!s) continue;
        if(tmp <= 8 && m10[tmp] - m10[tmp - 1] < i - s) continue;
        if(tmp <= 7 && m10[tmp + 1] - m10[tmp] < s) continue;
        ans = (ans + 1) % P;
    }
    for(int i = 1; i <= 30000000; i++) K[i] = K[i / 10] + 1;
    int nw = 0, t = 1;
    for(int i = 1; i <= 30000000; i++) {
        nw += K[i];
        while(nw > S) {
            nw -= K[t];
            t++;
        }
        if(nw == S && K[i] - K[t] > 1) ans = (ans + 1) % P;
    }
    printf("%lld\n", (ans % P + P) % P);
    return 0;
}