#include <iostream>
#include <cstdio>
using namespace std;
const int mod = 1e9 + 7;
int calc(int x){
    if(x <= 9) return 1;
    if(x <= 99) return 2;
    if(x <= 999) return 3;
    if(x <= 9999) return 4;
    if(x <= 99999) return 5;
    if(x <= 999999) return 6;
    if(x <= 9999999) return 7;
    return 8;
}
long long sum[23000005], S;
long long mypow(long long a, long long b){
    long long ans = 1;
    for(; b; b >>= 1) { if(b&1) (ans *= a) %= mod; (a *= a) %= mod; } return ans;
}
int main()
{
    cin>>S;
    for(int i = 1; i <= 23000004; i++){
        sum[i] = sum[i-1] + calc(i);
    }
    int j = 1;
    long long ans = 0;
    for(int i = 1; i <= 23000004; i++){
        while(sum[j] - sum[i-1] < S) j++;
        if(calc(i) > 7) break;
        if(sum[j] - sum[i-1] == S) ans++;
    }
    (ans += S/8) %= mod;
    for(int i = 1; i <= S/8; i++){
        if(S % i == 0){
            int x = S/i;
            ( (((ans += 9*mypow(10, x-1)) -= i) %= mod) += mod) %= mod;
        }
    }
    cout<<ans<<endl;
    return 0;
}
