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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

void solve(long long N) {
  ll x = 999'999'999'999'999;
  ll ans = 0;
  while (x > 0) {
    if (N > x) {
      ans += N - x;
    }
    x /= 1000;
  }
  cout << ans << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
using ll = long long;

int main() {

  ll N;
  cin >> N;

  if (1 <= N && N < pow(10, 3))
  {
    cout << 0 << endl;
    return 0;
  }else if (pow(10, 3) <= N && N < pow(10, 6))
  {
    cout << N-1000+1 << endl;
  }else if (pow(10, 6) <= N && N < pow(10, 9))
  {
    cout << 2*(N-1000000+1) + 999000 << endl;
  }else if (pow(10, 9) <= N && N < pow(10, 12))
  {
    cout << 3*(N-1000000000+1) + 2*999000000 + 999000 << endl;
  }else if (pow(10, 12) <= N && N < pow(10, 15))
  {
    cout << 4*(N-1000000000000+1) + 3*999000000000 + 2*999000000 + 999000 << endl;
  }else if (N == pow(10, 15))
  {
    cout << 5 + 4*999000000000000 + 3*999000000000 + 2*999000000 + 999000 << endl;
  }
  
  
  
}
