#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  long long cur = 9;
  long long ans = 0;
  long long dig = 1;
  cin >> n;
  while (n > 0) {
    ans += min(n * dig, cur * dig);
    n -= cur;
    cur *= 10;
    dig++;
  }
  cout << ans << endl;
  return 0;
}
