#include <iostream>
#include <string>
using namespace std;
using ll = long long;

int main(){
    ll N;
    cin >> N;
    for(ll i = 1; ; i++) if(stoll(to_string(i) + to_string(i)) > N){
        cout << i - 1 << endl;
        return 0;
    }
}

#include <bits/stdc++.h>
using namespace std;

int main(){
  int64_t N;
  cin >> N;

  int64_t ans= 0;
  int64_t div= 1'000;
  while(N >= div){
    ans+= N- (div- 1);
    div*= 1'000;
  }

  cout << ans << endl;
}