import Control.Applicative roman = ["I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"] x `mod'` y | x >= 0 = x `mod` y | x < 0 = (x + ((-x `div` y) + 1) * y) `mod'` y main = do [s, t] <- words <$> getLine putStrLn $ (roman !!) $ (head [i|i<-[1..12], roman!!(i-1) == s] + (read t) - 1) `mod'` 12