#include <bits/stdc++.h>
using namespace std;
using std::cout;
using ll=long long;
using ld=long double;
ll I=1167167167167167167;
ll Q=1e9+7;
#define rep(i,a) for (ll i=0;i<a;i++)
template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> ll LB(vector<T> v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> ll UB(vector<T> v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}else return 0;}
template<class T> void So(vector<T> &v) {sort(v.begin(),v.end());}
template<class T> void Sore(vector<T> &v) {sort(v.begin(),v.end());reverse(v.begin(),v.end());}
template<class T> void print(vector<T> v) {rep(i,v.size()) cout<<v[i]<<endl;}

//バイトで１５分ほど遅れて参加
int main() {
	ll N;
	cin>>N;
	ll A=1000;
	ll Z=0,X=N;
	while(X>=A){
		Z+=(X-A+1);
		A*=1000;
	}
	cout<<Z<<endl;
}
#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;
}