#include <algorithm>
#include<cfenv>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <list>
#include <map>
#include<numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#define itn int
#define retrun return
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;
vector<llong> AllDivisors(llong N) {
	vector<llong> ANS;
	for (llong i = 1; i * i <= N; i++) {
		if (N % i == 0) {
			ANS.push_back(i);
			if (N / i != i)ANS.push_back(N / i);
		}
	}
	sort(ANS.begin(), ANS.end());
	return ANS;
}
bool IsPrime(llong N) {
	for (llong i = 2; i * i <= N; i++) {
		if (N % i == 0) return false;
	}
	return true;
}
//ここまで共通
llong N;
int main() {
	cin >> N;
	llong zero = 0;
	llong ANS = 0;
	ANS += max(N - 999, zero);
	ANS += max(N - 999999, zero);
	ANS += max(N - 999999999, zero);
	ANS += max(N - 999999999999, zero);
	ANS += max(N - 999999999999999, zero);

	cout << ANS << endl;
}
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define N 2114514
const ll mod = 998244353;
const ll inf = 1000000000000000000;
int main() {
    ll n;
    cin >> n;
    ll ans = 0, l = 1, r = 10, num = 0;
    for (int i = 0;; i++) {
        if (r <= n) ans += num * (r - l);
        if (l <= n && n < r) {
            ans += num * (n - l + 1);
            break;
        }
        if (i % 3 == 2) num++;
        l *= 10;
        r *= 10;
    }
    cout << ans << endl;
    return 0;
}
