import Control.Applicative ((<$>)) main :: IO () main = do solve <$> getl words >>= putStrLn solve :: [String] -> String solve [s1, st] = let t = read st in toRoman . (`mod` 12) $ fromRoman s1 + t toRoman :: Int -> String toRoman 1 = "I" toRoman 2 = "II" toRoman 3 = "III" toRoman 4 = "IIII" toRoman 5 = "V" toRoman 6 = "VI" toRoman 7 = "VII" toRoman 8 = "VIII" toRoman 9 = "IX" toRoman 10 = "X" toRoman 11 = "XI" toRoman 12 = "XII" fromRoman :: String -> Int fromRoman "I" = 1 fromRoman "II" = 2 fromRoman "III" = 3 fromRoman "IIII" = 4 fromRoman "V" = 5 fromRoman "VI" = 6 fromRoman "VII" = 7 fromRoman "VIII" = 8 fromRoman "IX" = 9 fromRoman "X" = 10 fromRoman "XI" = 11 fromRoman "XII" = 12 getl :: (String -> a) -> IO a getl f = f <$> getLine