S1, T = input().split() s2t = {'I': 1, 'II': 2, 'III': 3, 'IIII': 4, 'V': 5, 'VI': 6, 'VII': 7, 'VIII': 8, 'IX': 9, 'X': 10, 'XI': 11, 'XII': 12} t2s = {v: k for k, v in s2t.items()} s2 = (s2t[S1] + int(T)) % 12 if s2 == 0: s2 = 12 print(t2s[s2])