#include<bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    unsigned long long N, t = 0;
    cin >> N;
    string S = "999";
    if (N>999) t += N-999;
    if (N>999999) t += N-999999;
    if (N>999999999) t += N-999999999;
    if (N>999999999999) t += N-999999999999;
    if (N>999999999999999) t += N-999999999999999;
    cout << t;  
}
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <bitset>
using namespace std;

typedef long long ll;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;

  ll n = N;
  ll d = 0;
  while(n/1000 > 0) {
    n /= 1000;
    d++;
  }
  
  ll ans = 0;
  ll base = pow(1000, d);
  ans += d*(N - base + 1);

  d--;
  while(d > 0) {
    ll base_next = pow(1000, d);
    ans += d * (base - base_next);
    d--;
    base = base_next;
  }

  cout << ans << endl;
  
  return 0;
}




