
#include<bits/stdc++.h>

using namespace std;


typedef long long ll ;
const ll mk = 100055;
const ll logn  = 29;
const ll mod = 1e9 + 7; 
#define endl "\n"
#define IOS  ios::sync_with_stdio(0); cin.tie(0);
#define fi first
#define se second
#define pii pair<ll,ll>
#define pq priority_queue
#define UwU              uwu
#define UwU              Mikuwu
#define Miku             best_waifu
#define Miku_dancing     god_waving
#define a_Miku           cho_doi_bot_ngu

ll Sum, ans = 0  ; 

ll log10(ll x) {
	if(x == 0) return 0;
	return log10(x / 10) + 1;
}

ll query(ll x, ll y)
{
    if (!y) return 1;
    ll l = query(x, y / 2);
    if (y % 2) return l * l % mod * x % mod;
    return l * l % mod;
}

signed main()
{
    
    cin >> Sum;
    ll r = 1, sub_sum = 0 ; 
    for (ll l = 1; l < 1e7; l++)
    {
        while (sub_sum + log10(r) <= Sum) sub_sum += log10(r), r++;
        if (sub_sum == Sum) ans++;
        sub_sum -= log10(l);
    }   // brute_forces for Miku to dance uwu
    for (ll dig = 8; dig <= Sum; dig++)
    {
        if (Sum % dig == 0)
        {
            ans = (ans  + query(10, dig) - query(10, dig - 1) - Sum / dig + 1 + mod) % mod;   // number of start a sequence
        }
        ll r = Sum % dig;
        if (r == 0) r += dig;
        ll val = r * (dig + 1);
        ll c = 1ll * dig * (dig + 1);
        if (val < Sum) ans = (ans + (Sum - val) / c + ((Sum - val) % c > 0)) % mod;   // still can take those numbers as a sequence
    }
    cout << ans % mod;
}
### Prompt

In cpp, your task is to solve 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<bits/stdc++.h>

using namespace std;


typedef long long ll ;
const ll mk = 100055;
const ll logn  = 29;
const ll mod = 1e9 + 7; 
#define endl "\n"
#define IOS  ios::sync_with_stdio(0); cin.tie(0);
#define fi first
#define se second
#define pii pair<ll,ll>
#define pq priority_queue
#define UwU              uwu
#define UwU              Mikuwu
#define Miku             best_waifu
#define Miku_dancing     god_waving
#define a_Miku           cho_doi_bot_ngu

ll Sum, ans = 0  ; 

ll log10(ll x) {
	if(x == 0) return 0;
	return log10(x / 10) + 1;
}

ll query(ll x, ll y)
{
    if (!y) return 1;
    ll l = query(x, y / 2);
    if (y % 2) return l * l % mod * x % mod;
    return l * l % mod;
}

signed main()
{
    
    cin >> Sum;
    ll r = 1, sub_sum = 0 ; 
    for (ll l = 1; l < 1e7; l++)
    {
        while (sub_sum + log10(r) <= Sum) sub_sum += log10(r), r++;
        if (sub_sum == Sum) ans++;
        sub_sum -= log10(l);
    }   // brute_forces for Miku to dance uwu
    for (ll dig = 8; dig <= Sum; dig++)
    {
        if (Sum % dig == 0)
        {
            ans = (ans  + query(10, dig) - query(10, dig - 1) - Sum / dig + 1 + mod) % mod;   // number of start a sequence
        }
        ll r = Sum % dig;
        if (r == 0) r += dig;
        ll val = r * (dig + 1);
        ll c = 1ll * dig * (dig + 1);
        if (val < Sum) ans = (ans + (Sum - val) / c + ((Sum - val) % c > 0)) % mod;   // still can take those numbers as a sequence
    }
    cout << ans % mod;
}
```