#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
using namespace std;
using P = pair<int,int>;
using ll = long long;

const long double EPS = 1e-10;

int main(){

  ll N;
  ll ans = 0;

  cin >> N;
  if(N <= 999){
    cout << ans << endl;
  }
  else if(N <= 999999){
    cout << 1 * (N-999) << endl;
  }
  else if(N <= 999999999LL){
    ans = 999000LL;
    cout << ans + 2 * (N-999999LL) << endl;
  }
  else if(N <= 999999999999LL){
    ans = 999000LL;
    ans += 2 * (999000000LL);
    cout << ans + 3 * (N-999999999LL) << endl;
  }
  else if(N <= 999999999999999LL){
    ans = 999000LL;
    ans += 2 * (999000000LL);
    ans += 3 * (999000000000LL);
    cout << ans + 4 * (N-999999999999LL) << endl;
  }
  else{
    ans = 999000LL;
    ans += 2 * (999000000LL);
    ans += 3 * (999000000000LL);
    ans += 4 * (999000000000000LL);
    cout << ans + 5 << endl;
  }

}

#include <bits/stdc++.h> 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
#define PI 3.14159265359  
const long long INF = 1LL << 60;
long long MOD = 1000000007;
long long gcd(long long a, long long b) { return b ? gcd(b, a%b) : a; }
long long lcm (int a, int b){return  (long long) a*b /gcd(a,b);}
double radian(double degree){return degree * PI /180.0;}
double degree(double radian){return radian * 180.0/PI;}

int main(){
    string S;
    cin >>S;

    int ans = 0;
    rep(i,S.length()){
        if (S.substr(i, 4) == "ZONe") ans++;
    }
    cout << ans << endl;
}