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;
const int dx[]={1,-1,0,0};
const int dy[]={0,0,1,-1};
const int MAXN=7e6+10;
const int MAXM=505;
const int INF=10000000;
const int mod=1e9+7;
 
ll power(ll a,ll b){
    ll c=1;
    while(b){
        if ((b&1)!=0) c=(c*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return c;
}
 
int f(int a){
    int len=0;
    while(a!=0){
        len++;
        a/=10;
    }
    return len;
}
 
int main(){
    int s;
    scanf("%d",&s);
    int r=0,sum=0,a=1,len1=1,b=1,len2=1;
    ll cnt1=0;
    for(int i=1;i<1e7;i++){
        if (i-1<a) sum-=len1-1;
        else a*=10,len1++,sum-=len1-1;
        while(sum<s){
            r++;
            if (r<b) sum+=len2-1;
            else b*=10,len2++,sum+=len2-1;
        }
        if (sum==s){
            cnt1++;
            if (cnt1==mod) cnt1=0;
        }
    }
    //cout<<cnt1<<endl;
    ll cnt2=0;
    for(int i=1;i*i<=s;i++){
        if (s%i!=0) continue;
        if (i*8<=s){
            cnt2+=(((power(10,s/i-1)*9)%mod-i)%mod+mod)%mod;
            cnt2%=mod;
        }
        if (i*i!=s && i>=8){
            cnt2+=(((power(10,i-1)*9)%mod-s/i)%mod+mod)%mod;   
            cnt2%=mod;
        }

    }
    ll cnt3=s/8;
    cout<<((cnt1+cnt2)%mod+cnt3)%mod<<endl;
    return 0;
}