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;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const ll MOD = (ll)(1e9 + 7);

int f(ll x) {
  int k = 0;
  while (x > 0) {
    k++;
    x /= 10;
  }
  return k;
}


ll mod_pow(ll a, ll b, ll p) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    a = (a * a) % p;
    b >>= 1;
  }
  return res;
}

// (10^n - 1) % MOD
ll nine(int n) {
  ll res = mod_pow(10, n-1, MOD);
  res = res * 9 % MOD;
  return res;
}

int main2() {
  ll S = nextInt();
  ll ans = 0;
  int l = 1;
  int r = 1;
  // [l, r]
  ll s = 0;
  while (l <= 9999999) {
    if (s == S) {
      ans++;
    }
    if (s < S) {
      s += f(r);
      r++;
    } else {
      s -= f(l);
      l++;
    }
  }
  ans %= MOD;

  for (int L = 1; L <= S; L++) {
    // 1種類
    if (S % L == 0) {
      const int v = S / L;
      if (v >= 8) {
        ans += ((nine(v) - L + 1) % MOD + MOD) % MOD;
        ans %= MOD;
      }
    }
    // 2種類
    if (L >= 2) {
      const int v = S / L;
      if (v >= 8 && S % L != 0) {
        ans++;
        ans %= MOD;
      }
    }
  }

  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}