#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve() {
	long long n;
	cin >> n;
	int comma = 0;
	int cnt = 2;
	long long curr = 1000, res = 0;
	while (curr <= n) {
		cnt++;
		comma = cnt / 3;
		long long a = curr, b = min(n, curr * 10 - 1);
		res += comma * (b - a + 1);
		debug() << imie(res) imie(a) imie(b) imie(cnt);
 		curr *= 10;
	}
	cout << res << "\n";
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
	}
}

#include <iostream>
using namespace std;
typedef long long ll;

int main(void) {
	ll n;
	ll ans = 0;

	cin >> n;


	if (n >= 1000) {
		ans += n - 999;
	}
	if (n >= 1000000) {
		ans += n - 999999;
	}
	if (n >= 1000000000) {
		ans += n - 999999999;
	}
	if (n >= 1000000000000) {
		ans += n - 999999999999;
	}
	if (n >= 1000000000000000) {
		ans += n - 999999999999999;
	}

	cout << ans << endl;

	return 0;
}