#include<iostream>

using namespace std;
typedef long long ll;
int main(){
    ll n;cin >> n;
    ll ans = 0;
    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;
}
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll  long long
#define pb push_back
#define vec vector<ll>
#define pii pair<ll,ll>
#define pr_que priority_queue<pii,vector<pii>,greater<pii> >
#define itr(i,x,y) for(ll i=x;i<y;i++)
#define mod 1000000007
const long long N=200001,INF=1000000000000000000;
const double err=1e-9;
int main()
{
	IOS;
	ll n,ans=0,k=1;
	cin >> n;
	itr(i,1,6)
	{
		k*=1000;
		if(n>=k) ans+=n-k+1;
	}
	
	cout <<ans;
	return 0;
}
