#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <deque>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int mod = 1000000007;
const int N = 23000001;

deque<pii > v;

LL _pow(LL a, LL b) {
  if(!b) return 1;
  if(b == 1) return a;
  if(b == 2) return a * a % mod;
  if(b & 1) {
    return a * _pow(a,b-1) % mod;
  }
  return _pow(_pow(a,b/2),2);
}

int main() {
  int n;
  S(n);
  int ans = 0;
  rep(i,1,n/8+1) {
    if(n % i == 0) {
      ans += _pow(10, n / i) - _pow(10, (n / i) - 1) - (i - 1);
      ans %= mod;
      if(ans < 0) ans += mod;
    } else {
      ans++;
      if(ans >= mod) ans -= mod;
    }
  }
  int d = 1;
  int sm = 0;
  int p = 0;
  v.pb(mp(0,0));
  int idx = 0;
  rep(i,1,N) {
    if(i == 10 || i == 100 || i == 1000 || i == 10000 || i == 100000 || i == 1000000 || i == 10000000) {
      d++;
      p = 0;
    }
    sm += d;
    p += d;
    v.pb(mp(sm,i));
    while(v.front().FF + n < sm) v.pop_front();
    if(v.front().FF + n == sm && i - v[idx].SS > n / 8) {
      ans++;
      if(ans == mod) ans = 0;
    }
  }
  P(ans);
  return 0;
}
