#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
using namespace std;
int main(){
    ll x;
    cin>>x;
    ll d=x/11;
    ll r=x%11;
    if(0==r){
        cout<<2*d<<endl;
    }else{
        if(r<7){
            cout<<2*d+1ll<<endl;
        }else{
            cout<<2*d+2ll<<endl;
        }
    }
    return 0;
}
#include <iostream>
#include <string>
#include <map>
#include <string.h>
using namespace std;
int main(){
  map<char,int> ch;//文字の数字辞書登録
  ch['I']=1;
  ch['V']=5;
  ch['X']=10;
  ch['L']=50;
  ch['C']=100;
  ch['D']=500;
  ch['M']=1000;
  
  int ans=0;
  int len=0;
  char s[1111];
  while(cin >> s){
    len=strlen(s);
    for(int i=0;i<len;i++){
      if(ch[s[i]]<ch[s[i+1]]){//もしも引き算をすべき場合だったら
	ans-=ch[s[i]];
      }else{
	ans+=ch[s[i]];
      }
    }
    cout << ans << endl;
    ans=0;
  }
}