d = {"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, t = input().split() t = int(t) x = d[s] y = (x+t) % 12 if y == 0: print('XII') else: z = [k for k, v in d.items() if v == y] print(z)