#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
using namespace std;

int main(){
    int i(0);
    string s;
    bool t=true;
    cin >> s;
    
    if (s == "VI"){printf ("IV");t=false;} 
    if (s == "XVI"){printf ("XIV");t=false;} 
    if (s == "XXVI"){printf ("XXIV");t=false;} 
    if (s == "XXXVI"){printf ("XXXIV");t=false;} 
    if (s == "XLVI"){printf ("XLIV");t=false;} 
    if (s == "LVI"){printf ("LIV");t=false;} 
    if (s == "LXVI"){printf ("XLIV");t=false;} 
    if (s == "LXXVI"){printf ("LXXIV");t=false;} 
    if (s == "LXXXVI"){printf ("LXXXIV");t=false;} 
    if (s == "XCVI"){printf ("XCIV");t=false;} 
    
    if (s == "XI"){printf ("IX");t=false;}  
    if (s == "XXI"){printf ("XIX");t=false;} 
    if (s == "XXXI"){printf ("XXIX");t=false;} 
    if (s == "LXXI"){printf ("XLIX");t=false;}     
    
    if (s == "LX"){printf ("XL");t=false;}   
    if (s == "LXI"){printf ("XLI");t=false;} 
    if (s == "LXII"){printf ("XLII");t=false;} 
    if (s == "LXIII"){printf ("XLIII");t=false;} 
    if (s == "LXIV"){printf ("XLIV");t=false;} 
    if (s == "LXV"){printf ("XLV");t=false;} 
    if (s == "LXVII"){printf ("XLVII");t=false;} 
    if (s == "LXVIII"){printf ("XLVIII");t=false;} 
    if (s == "LXIX"){printf ("XLIX");t=false;}
    
  
    
    if(t==true){
         cout << s;
    }
        
    

  //  system ("pause");
    return 0;
}
