#include<bits/stdc++.h>
using namespace std;
void solve() {
    long long N;
    cin >> N;
    long long ll = 1;
    long long rr = 10;
    int len = 1;
    long long answer = 0;
    while(ll <= N) {
        answer += (min(N + 1, rr) - ll) * ((len - 1) / 3);
        len++;
        ll *= 10;
        rr *= 10;
    }
    cout << answer << endl;
}
int main() {
    solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define println(x) cout<<(x)<<'\n';
#define print(x) cout<<(x)<<' ';

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n;
    cin >> n;


    set<int> a;
    for (int i = 2; i <= 10000; i++) {
        if (i == 6 || i == 10 || i == 15)
            continue;
        int cnt = 0;
        if (i % 2 == 0)
            cnt++;
        if (i % 3 == 0)
            cnt++;
        if (i % 5 == 0)
            cnt++;
        if (cnt >= 2) {
            a.insert(i);
        }
    }

    cout << "6 10 15 ";


    n -= 3;
    while (n--) {
        cout << (*a.begin()) << ' ';
        a.erase(a.begin());
    }

}


