#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    unsigned long long int t,n,i,x,mx,mn,f,j,s,r,y;
    cin>>x;
    s=0;
    n=999000000000;
    if(x>999)s+=(x-999);
    if(x>999999)s+=(x-999999);
    if(x>999999999)s+=(x-999999999);
    if(x>999999999999)s+=(x-999999999999);
    if(x>999999999999999)s+=(x-999999999999999);
    cout<<s<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long N;
  cin >> N;
  int x = (int)log10(N) + 1;
  long long res = 0;
  if (x >= 4) {
    int y = x - 3;
    rep(i, y) {
      int z = i + 3;
      if (i < y - 1)
        res += ((long)pow(10, z) * 9) * ((int)z / 3);
      else
        res += (N - (long)pow(10, z) + 1) * ((int)z / 3);
    }
  }
  cout << res << endl;
}