roma_num = ["I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"] def toString(i): print(i) if 0 < i < 13: return roma_num[i-1] else: print("error on toString") return "error" def toNum(s): for i, rom in enumerate(roma_num): if s == rom: return i+1 return -1 S1, T = input().split() s = toNum(S1) res = s + int(T) t = toString(res%12 if res%12 != 0 else 12) print(t)