#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;
}

### Prompt

Please formulate a cpp solution to the following 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

### Response

```cpp
#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;
}

```