program rimski;

var  c:string;

begin
              readln(c);
              if c='VI' then writeln('IV') else if c='XI' then writeln('IX') else if c='XVI' then writeln('XIV') else if c='XXI' then writeln('XIX') else if c='XXVI' then writeln('XXIV') else if c='XXXI' then writeln('XXIX')
              else if c='XXXVI' then writeln('XXXIV') else if c='XLI' then writeln('XXXIX') else if c='XLVI' then writeln('XLIV') else if c='LI' then writeln('XLIX') else if c='LVI' then writeln('LIV')
              else if c='LXI' then writeln('LIX') else if c='LXVI' then writeln('LXIV') else if c='LXXI' then writeln('LXIX') else if c='LXXVI' then writeln('LXXIV') else if c='LXXXI' then writeln('LXXIX') else if c='LXXXVI' then writeln('LXXXIV')
              else if c='XCI' then writeln('LXXXI') else if c='XCVI' then writeln('XCIV') else if c='LX' then writeln('XL') else writeln(c);


end.
