#include <iostream>

using namespace std;

typedef long long ll;
int main()
{
    ll n;ll ans=0;
    cin>>n;
    if(n-999>0)
        ans+=n-999;
    if(n-999999>0)
         ans+=(n-999999);
    if(n-999999999>0)
          ans+=(n-999999999);
    if(n-999999999999>0)
           ans+=(n-999999999999);
    if(n-999999999999999>0)
           ans+=(n-999999999999999);
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define eps (double)(1e-9)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
   	ll n;
    cin >> n;
    ll ans = 0;
    ll now = 10, cnt = 2;
    while(now <= n){
        ans += ((cnt-2)/3)*(now-now/10);
        now *= 10;
        cnt++;
    }
    ans += ((cnt-2)/3)*(n-now/10+1);
    cout << ans << endl;
}