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