#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;
#define rep(i,n) for(long long int i=0;i<(n);i++)
typedef long long ll;
typedef pair<int, int> P;

int gcd(int a, int b) {
    if (a % b == 0) {
        return b;
    }
    else {
        return gcd(b, a % b);
    }
}
ll lcm(int a, int b) {
    ll res = (ll)a * b / gcd(a, b);
    return res;
}
int main() {
    long long int n;
    cin >> n;
    int rank=0;
    long long int ans = 0;
    long long int tmp = 1;
    for (long long int i = 1; i<=n; i *= 10) {
        rank++;
        rep(i, (ll)rank - 2) {
            tmp *= 10;
        }
        ans += (ll)tmp * 9 * ((rank - 2) / 3);
        tmp = 1;
    }
    if (rank >= 4){
        rep(i, (ll)rank - 1)
          tmp *= 10;
        ans += (n - tmp + 1)*((rank-1)/3);
    }
    cout << ans;
    return 0;
}
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;


//defines...
#define ll           long long
#define boost        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb           push_back
#define mp           make_pair
#define in           insert
#define pi           2*acos(0.0)
#define srt(s)       sort(s.begin(),s.end())
#define rsrt(s)      sort(s.rbegin(),s.rend())
#define all(x)       x.begin(),x.end()
#define mem(a, b)    memset(a, b, sizeof(a))
#define c_test       printf("Case %lld: ",t)

const ll mod=1e9+7;
const ll MX=2e5+5;


inline void norm(ll &a) {a%=mod; (a<0) && (a+=mod) ;}                            //positive mod value
inline ll modAdd(ll a,ll b) {a%=mod, b%=mod; norm(a),norm(b); return (a+b)%mod;} //modular addition
inline ll modSub(ll a,ll b) {a%=mod, b%=mod; norm(a),norm(b); return (a-b)%mod;} //modular subtraction
inline ll modMul(ll a,ll b) {a%=mod, b%=mod; norm(a),norm(b); return (a*b)%mod;} //modular multiplication

inline ll bigMod(ll b,ll p)  {ll r=1; while(p) {if(p & 1LL) r=modMul(r,b) ;b=modMul(b,b) ; p>>=1LL ; } return r; }
inline ll modInverse(ll a) {return bigMod(a,mod-2); }
inline ll modDiv(ll a ,ll b) { return modMul(a,modInverse(b)) ;}


typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

int dRow[] = { -1, 0, 1, 0 };
int dCol[] = { 0, 1, 0, -1 };

//code goes from here...



int main()
{
//#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    
    //freopen("output.txt", "w", stdout);
//#endif

    boost
    //---------------------------------
    ll n;
    cin >> n;
    if(n==3)
    {
        cout << "6 10 15\n";
        return 0;
    }
    vector<ll> v;
    set<ll> s;
     
    for(ll i=6;i<=10000;i+=6) s.in(i);
    for(ll i=10;i<=10000;i+=10) s.in(i);
    for(ll i=15;i<=10000;i+=15) s.in(i);
   

    for(auto i: s) v.pb(i);

    for(ll i=0;i<n;i++) cout << v[i] <<  ' ';

    cout << endl;

    
    //---------------------------------
    
    return 0;
}