#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint numz[10];
lint mo=1000000007;
lint zyo(lint x,lint y){
    lint ret=1,a=x;
    while(y>0){
    	if(y%2==1) ret=(ret*a)%mo;
    	a=(a*a)%mo;y/=2;
    }
    return ret;
}
lint s;
//dig桁のをnum個とるとり方
lint cal(int dig,int num){
	if(dig<10 && 9*zyo(10,dig-1)<(lint)num) return 0;
	lint ret=(9*zyo(10,dig-1)-num+1)%mo;
	if(s/num>=8) ret--;
	return ret;
}
int main()
{
	cin>>s;lint out=0;
	numz[0]=1;rep(i,9) numz[i+1]=numz[i]*10;
	//1つの桁だけ
	for(int i=1;i*i<=s;i++){
		if(s%i>0){
			//if(s/i>=8) out++;
		}
		else{
			out+=cal(i,s/i);
			if(i*i<s) out+=cal(s/i,i);
		}
		out%=mo;
	}
	out+=s/8;
	REP(i,1,8) REP(j,i+1,9){
		lint numd=0;
		REP(k,i+1,j) numd+=k*9*numz[k-1];
		if(numd>=s) continue;
		REP(k,1,9*(int)numz[i-1]+1){
			lint rest=s-numd-i*k;
			if(rest%j>0LL || rest<1LL || rest/j>9*numz[j-1]) continue;
			out++;out%=mo;
		}
	}
	/*REP(i,1,8){
		if(s%i==0LL && s/i<=9*numz[i-1]) out+=9*numz[i-1]-s/i+1;
		out%=mo;
	}*/
	cout<<(out%mo+mo)%mo<<endl;
}

### Prompt

Generate 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<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint numz[10];
lint mo=1000000007;
lint zyo(lint x,lint y){
    lint ret=1,a=x;
    while(y>0){
    	if(y%2==1) ret=(ret*a)%mo;
    	a=(a*a)%mo;y/=2;
    }
    return ret;
}
lint s;
//dig桁のをnum個とるとり方
lint cal(int dig,int num){
	if(dig<10 && 9*zyo(10,dig-1)<(lint)num) return 0;
	lint ret=(9*zyo(10,dig-1)-num+1)%mo;
	if(s/num>=8) ret--;
	return ret;
}
int main()
{
	cin>>s;lint out=0;
	numz[0]=1;rep(i,9) numz[i+1]=numz[i]*10;
	//1つの桁だけ
	for(int i=1;i*i<=s;i++){
		if(s%i>0){
			//if(s/i>=8) out++;
		}
		else{
			out+=cal(i,s/i);
			if(i*i<s) out+=cal(s/i,i);
		}
		out%=mo;
	}
	out+=s/8;
	REP(i,1,8) REP(j,i+1,9){
		lint numd=0;
		REP(k,i+1,j) numd+=k*9*numz[k-1];
		if(numd>=s) continue;
		REP(k,1,9*(int)numz[i-1]+1){
			lint rest=s-numd-i*k;
			if(rest%j>0LL || rest<1LL || rest/j>9*numz[j-1]) continue;
			out++;out%=mo;
		}
	}
	/*REP(i,1,8){
		if(s%i==0LL && s/i<=9*numz[i-1]) out+=9*numz[i-1]-s/i+1;
		out%=mo;
	}*/
	cout<<(out%mo+mo)%mo<<endl;
}

```