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>
#include <cstring>
#include <set>
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <random>
#include <chrono>
using namespace std;

int S;
long long power[18];
const int mod = 1e9 + 7;

int qpow(int a, int n){
    int ret = 1;
    while(n > 0){
        if(n & 1)
            ret = 1LL * ret * a % mod;
        a = 1LL * a * a % mod;
        n >>= 1;
    }
    return ret;
}

void add(int &a, int b){
    a += b;
    if(a >= mod)
        a -= mod;
}

const int maxn = 3e7 + 5;
int digit[maxn];

int main(){
    cin >> S;
    power[0] = 1;
    for(int i = 1;i < 18;i++){
        power[i] = power[i - 1] * 10;
    }
    int i;
    int ans = 0;
    for(i = 1; S / i >= 8;i++){
        if(S % i == 0){
            int digit = S / i;
            int p = qpow(10, digit - 1);
            p = 1LL * p * 9 % mod;
            p = (p + 1 - i + mod) % mod;
            add(ans, p);
        }else{
            add(ans, 1);
        }
    }
    digit[0] = 0;
    int ans1 = 0;
    for(int i = 0;i <= 3e6;i++){
        int tmp = digit[i];
        for(int j = 0;j < 10;j++){
            digit[i * 10 + j] = tmp + 1;
        }
    }
    digit[0] = 0;
    for(int i = 1;i < maxn;i++){
        digit[i] = digit[i - 1] + digit[i];
    }
    int l = 0;
    for(int r = 1;r < maxn;r++){
        while(digit[r] - digit[l] > S){
            l++;
        }
        if(digit[r] - digit[l] == S and (r - l) >= i){
            ans1++;
        }
    }
    add(ans, ans1);
    cout << ans << endl;
    return 0;
}