#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,ans;
int main(){
	cin>>n;
	for(ll i=1000;i<1000000000000000000;i*=1000){
		if(i>n) break;
		ans+=n-(i-1);
	}
	cout<<ans<<endl;
	return 0;
}
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <string>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, set<T> &s) {
	for (auto e : s)
		out << e << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, pair<T, N> &p) {
	out << "(" << p.first << ", " << p.second << ") ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		cout << v[i];
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<set<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
	}
	out << "\n";
   	return out;
}

void solve() {
	long long n;
	cin >> n;

	long long curr = 1e6;
	long long ans = 0;
	int commas = 1;
	while (curr <= n) {
		ans += (long long) commas * (curr - (curr / 1000));
		curr *= 1000;
		++commas;
	}

	ans += (long long) commas * (n - (curr / 1000) + 1);
	cout << max(ans, (long long) 0) << "\n";
	
	return ;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int t;
	t = 1;

	while (t--) {
		solve();
	}

	return 0;

}