#include<bits/stdc++.h>
using namespace std;

using ll = long long;

constexpr int mod = 1e9+7;

ll pw(ll a, int n)
{
    if(!n) return 1;
    if(n&1) return a*pw(a,n-1)%mod;
    return pw(a*a%mod,n/2);
}

int main()
{
    int s;
    long long ans=0;
    scanf("%d",&s);
    for(int i=1;i<=s;i++)
    {
        int l = s/i, r = (s+i-1)/i;
        if(r<9) break;
        int b = s-l*i, a = i-b;
        if(b) ans++;
        else ans = (ans + mod + pw(10,l-1)*9%mod - a + 1)%mod;
    }
    int cur=0, l=1, ls=1,rs=1, ln=10,rn=10;
    for(int r=1;r<100000000;r++)
    {
        if(r == rn)
        {
            rn *= 10;
            rs++;
        }
        cur += rs;
        while(cur>s)
        {
            cur -= ls;
            l++;
            if(l == ln)
            {
                ln *= 10;
                ls++;
            }
        }
        ans += s == cur;
    }
    printf("%lld\n",ans%mod);
}
