#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
	ll n;
	cin>>n;
	ll ans=0;
	if(n>=1000)ans+=(n-999);
	//cout<<ans<<" ";
	if(n>=1000000)ans+=(n-999999);
	if(n>=1000000000)ans+=(n-999999999);
	if(n>=1000000000000)ans+=(n-999999999999);
	if(n==1e15)ans+=1;
	//if(n>=1000000000000000)ans+=n=999999999999999;
	cout<<ans;
}
int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   int t=1;
   //cin>>t;
   while(t--){
		solve();
   }
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <queue>

#define pb push_back
#define pob pop_back
#define pll pair <long long, long long>
#define pld pair <long double, long double>
#define ll long long
#define ull unsigned long long
#define ld long double
#define Int int 
#define itn int
#define nit int
#define int long long
#define x first
#define y second

using namespace std;

const int N = 1e4 + 123;
const int INF = 2 * 1e18 - 1;
const int inf = 2 * 1e9 - 1;

bool prime(int x) {

    for (int i = 2;i <= sqrt(x);i++) {

        if (x % i == 0) {

            return 0;

        }

    }

    return 1;

}

void factorizing(int x) {

    if (prime(x)) {

        cout << x;return;

    }

    int div = 2;

    while (x) {

        if (x % div == 0) {

            cout << div << ' ';
            x /= div;
            div = 2;

        }
        else {

            div++;

        }

    }

}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    
    int sum = 0;
    int cnt = 0;

    int then = 1000;

    for (int i = 1000;i <= n;i *= 10) {

        if (i == then) {

            cnt++;
            then *= 1000;

        }

        int log = (int)log10(i);
        int next = pow(10, log + 1);
        int minus = min(n - i + 1, next - i);

        sum += (minus * cnt);

    }

    cout << sum;

    return 0;

}