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 <algorithm>

using namespace std;

int mod = 1000000007;
int a[9];

long long powmod(long long x, long long y) {
    long long ans = 1;
    
    while (y > 0) {
        if (y & 1) ans = ans * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    
    return ans;
}

int main() {
    int s, i, j;
    long long ans = 0;
    
    scanf("%d", &s);
    
    a[1] = 9;
    for (i = 2; i <= 8; i++) a[i] = a[i - 1] * 10;
    
    for (i = 1; i <= min(s, 7); i++) {
        int r = s, p = 0, q;
        
        for (j = i; ; j++) {
            int x = a[j];
            
            if (r >= j * x) {
                r -= j * x;
            } else {
                q = r / j;
                r %= j;
                
                break;
            }
        }
        
        while (1) {
            if (r == 0) ans++;
            
            r -= j;
            q++;
            
            if (q == a[j]) {
                j++;
                q = 0;
            }
            
            p += -r / i;
            r += -r / i * i;
            
            if (p >= a[i]) break;
        }
    }
    
    for (i = 8; i <= s; i++) {
        int c = s / i;
        int x = s % i;
        
        if (x == 0) ans += powmod(10, i - 1) * 9 - c + 1;
        
        if (c > x) {
            if (x > 0) ans++;
            ans += (c - x - 1) / (i + 1);
        }
    }
    
    printf("%lld\n", ans % mod);
    
    return 0;
}