-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU roman = ["I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"] main = putStrLn . solve . words =<< getLine solve [t, a] = ans where h = length $ takeWhile (/= t) roman x = (h + 2400 + (read a)) `mod` 12 ans = roman !! x