#define LOCAL

#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

// From Errichto's Youtube stream
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////
const int MOD = 1000000007;
int S;

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

int mul (int a, int b) {
    return (int64)a * b % MOD;
}

int f(int X) {
    if (!X)
        return 0;
    int nr = 0;
    for (; X; X /= 10)
        nr++;
    return nr;
}

int fastpow(int a, int p) {
    if (!p) return 1;
    if (p == 1) return a;
    int res = fastpow(a, p >> 1);
    res = mul (res, res);
    if (p & 1)
        res = mul (res, a);
    return res;
}

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

    cin >> S;

    int r = 0;
    int nr = 0;
    int cur = 0;
    int result = 0;

    for (int l = 1; l < 10000000; l++) {
        nr -= f(l-1);
        while (nr <= S) {
            cur = f(r + 1);
            if (nr + cur <= S) {
                //debug() << l << " " << r << " " << cur << " " << nr + cur;
                r += 1;
                nr += cur;
            } else {
                break;
            }
        }

        if (nr == S && r >= l) {
            add(result, 1);
            //debug() << l << " " << r;
        }

        // if (l >= 1000000 && r > 10000000 && nr == S) {
        //     debug() << l << " " << r << " ";
        // }
    }

    set<int> div;

    for (int d = 1; d * d <= S; d++) {
        if (S % d == 0) {
            div.insert(d);
            div.insert(S / d);
        }
    }

    //debug() << "intermed: " << result;

    add(result, S / 8);

    for (auto el : div) {
        if (el < 8)
            continue;

        //debug() << "div: " << el;

        // (10 ^ div - 10 ^ (div - 1)) - div + 1 
        int p1 = fastpow(10, el - 1);
        int p2 = mul(p1, 10);

        //assert(fastpow(10, el) == p2);
        int dif = p2;
        add (dif, MOD - p1);
        add (dif, MOD - (S / el));

        add(result, dif); 
    }

    //add (result, S - 8 + 1);

    cout << result << "\n";

    // S = 123;
    // for (int l = 7; l <= 123; l++) {
    //     for (int a = 1; a <= 100; a++) {
    //         int dif = S - a * l;
    //         if (dif < a && dif >= 1) {
    //             debug() << l << " " << a << " " << dif << " -> " << (a - dif) * l + dif * (l + 1);
    //         }
    //     }
    // }

    return 0;
}


Measured memory_bytes: 256