#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define vec(a, y, x) vector<vector<char>> a(y, vector<char>(x))
using P = pair<int, int>;
using T = tuple<int, int, int>;
const double PI = 3.14159265358979323846;
const in MOD = 1000000007;
const in INF = 1e18 + 7;
const int inf = 1e9 + 7;
const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
//cout << fixed << setprecision(10);

int main(void)
{
    in n;
    cin>>n;
    int rank=0;
    in ans =0;
    in nani = n/pow(10,3);//1
    if(nani>0)
        rank++;

    nani = nani / pow(10, 3);//2
    if (nani > 0)
        rank++;

    nani = nani / pow(10, 3);//3
    if (nani > 0)
        rank++;

    nani = nani / pow(10, 3);//4
    if (nani > 0)
        rank++;
    nani = nani / pow(10, 3);//5
    if (nani > 0)
        rank++;
    
    
    if(rank == 1){
        ans+=n-999;
    }
    if(rank >=2){
        ans+=pow(10,6) - pow(10,3);
    }
    if(rank == 2){
        ans+=(n+1-pow(10,6))*2;
    }

    if (rank >= 3)
    {
        ans += (pow(10, 9) - pow(10, 6))*2;
    }
    if (rank == 3)
    {
        ans += (n + 1 - pow(10, 9))*3;
    }

    if (rank >= 4)
    {
        ans += (pow(10, 12) - pow(10, 9))*3;
    }
    if (rank == 4)
    {
        ans += (n + 1 - pow(10, 12))*4;
    }

    if(rank == 5){
        ans += 5;
        ans += (pow(10, 15) - pow(10, 12)) * 4;
    }
    cout<<ans<<endl;
    //cout<<rank<<endl;
}
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N;
  cin >> N;
  string a = to_string(N);
  int B = a.size();
  if (B <= 3) {
    cout << 0 << endl;
  }
  else if (B <= 6) {
    cout << N - 999 << endl;
  }
  else if (B <= 9) {
    cout << (N - 999999) * 2 + 999000 << endl;
  }
  else if (B <= 12) {
    cout << (N - 999999999) * 3 + 999000000 * 2 + 999000 << endl;
  }
  else if (B <= 15) {
    cout << (N - 999999999999) * 4 + 999000000000 * 3 + 999000000 * 2 + 999000 << endl;
  }
  else if (B <= 18) {
    cout << (N - 999999999999999) * 5 + 999000000000000 * 4 + 999000000000 * 3 + 999000000 * 2 + 999000 << endl;
  }
}