#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)


template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }




long long calc(long long r) {
  long long con = 0, pow = 1;
  for (con = 0; con < 10; ++con) {
	pow *= 10;
	if (r < pow) break;
  }
  pow /= 10;

  /*
  COUT(pow);
  COUT(con);
  */
  
  long long res = (r - pow + 1) * (con + 1);
  long long tmp = 9;
  for (int i = 1; i <= con; ++i) {
	res += tmp * i;
	tmp *= 10;
  }

  return res;
}



const long long MOD = 1000000007;



inline long long mod(long long a, long long m) {
    return (a % m + m) % m;
}

long long pow(long long a, long long n, long long m) {
    if (n == 0) return 1 % m;
    long long t = pow(a, n/2, m);
    t = mod(t * t, m);
    if (n & 1) t = mod(t * a, m);
    return t;
}

long long inv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a/b;
        a -= t*b; swap(a, b);
        u -= t*v; swap(u, v);
    }
    return mod(u, m);
}


long long anum(int a) {
  long long res = 9;
  for (int i = 0; i < a-1; ++i) res *= 10;
  return res;
}
  

long long S;

int main() {
  /*
  for (int i = 1; i <= 100; ++i) {
	cout << i << ": " << calc(i) << endl;
  }  
  COUT(calc(999));
  COUT(calc(1000));
  COUT(calc(1001));
  */

  while (cin >> S) {
	long long res = 0;
	for (long long l = 1; l < 1000000; ++l) {
	  long long shita = calc(l-1);
	  long long lo = l-1, hi = 100000000;
	  while (hi - lo > 1) {
		long long mid = (hi + lo) / 2;
		long long tmp = calc(mid) - shita;
		if (tmp >= S) hi = mid;
		else lo = mid;
	  }
	  if (calc(hi) - shita == S) ++res;
	}

	for (int p = 1; p <= S/2; ++p) {
	  int a = S/p;
	  if (a <= 6) break;
	  int r = S%p;
	  int q = p-r;

	  //COUT(a*q + (a+1)*r);
	  if (a <= 15) {
		if (q > anum(a)) continue;
		if (r > anum(a+1)) continue;
	  }

	  long long tmp = 1;
	  
	  if (r == 0) {
		tmp = pow(10LL, a-1, MOD);
		tmp = mod(tmp * 9, MOD);
		tmp = mod(tmp - (q-1), MOD);
	  }
	  res += tmp;
	  res %= MOD;
	}

	cout << res << endl;
  }
}














Measured memory_bytes: 256