var b:string; l:integer;
begin
readln(b);
l:=length(b);
if (b[l-1]='V') and (b[l]='I') then begin b[l-1]:='I';
                                                          b[l]:='V';
                                                    end;
if (b[l-1]='X') and (b[l]='I') then begin b[l-1]:='I';
                                                          b[l]:='X';
                                                    end;
if (b[1]='L') and (b[2]='X') and (b[3]<>'X') then begin b[1]:='X';
                                                        b[2]:='L';
                                                  end;
if b='LIX' then b:='XLI';
writeln(b);
end.

