var s:string;
z,i,b,k,a,l,p:integer;
c,m,n:char;
begin

readln(s);
p:=length(s);







  if (s[1]='L') and (s[2]='X') and(s[2]<>'X')  then begin s[1]:='X';
                                                           s[2]:='L';  end;

 if (s[p-1]='X') and (s[p]='I') then  begin s[p]:='X';s[p-1]:='I';   end;


  if (s[p-1]='V') and (s[p]='I') then  begin s[p]:='V'; s[p-1]:='I';  end;

  if s='LXXI' then s:='XLIX';




writeln(s);


end.