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>

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   mod = 1e9 + 7;

void add(int &a,int b)  {
    a += b;
    if (a >= mod)
        a -= mod;
}
void sub(int &a,int b)  {
    a -= b;
    if (a <  0)
        a += mod;
}
int mul(int a,int b)    {   return  1ll * a * b % mod;  }
int Pow(int a,int b)    {
    int ans = 1;
    while  (b)  {
        if (b & 1)  ans = mul(ans,a);
        a = mul(a,a);   b >>= 1;
    }
    return  ans;
}

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int S;  cin >> S;

    int ans = 0;

    for(int i = 1 ; i <= S ; ++i)   if (S % i == 0) {
        if (i < 9 && S / i > 9 * Pow(10,i - 1))
            continue;
        
        add(ans,mul(9,Pow(10,i - 1)));
        sub(ans,S / i);
        add(ans,1);
    }
    for(int i = 8 ; i <= S ; ++i)   {
        int q = S / i;
        int r = S % i;

        if (r == 0) {
            r = i;
            q--;
        }
        if (q <= r) continue;

        add(ans,(q - r - 1) / (i + 1) + 1);
    }
    for(int i = 1 ; i < 8 ; ++i)    {
        int r1 = 9 * Pow(10,i - 1);
        int r2 = r1 * 10;

        for(int j = 1 ; j <= r1 ; ++j)  {
            if (i * j >= S) break;
            if((S - i * j) % (i + 1))
                continue;
            
            if((S - i * j) / (i + 1) <= r2)
                add(ans,1);
        }
    }

    for(int l = 1     ; l <= 6 ; ++l)
    for(int r = l + 2 ; r <= 8 ; ++r)   {
        int rem = S;

        for(int j = l + 1 ; j < r ; ++j)
            rem -= j * 9 * Pow(10,j - 1);
        
        if (rem < 0)    continue;

        int hig1 = 9 * Pow(10,l - 1);
        int hig2 = 9 * Pow(10,r - 1);

        for(int a = 1 ; a <= hig1 ; ++a)    {
            if (a * l >= rem)   break;
            if ((rem - a * l) % r == 0 && (rem - a * l) / r <= hig2)
                add(ans,1);
        }
    }
    cout << ans << endl;
}