roman = ["XII", "I","II","III","IIII","V","VI","VII","VIII","IX","X","XI"] s1, _t = input().split() t = int(_t) i = roman.index(s1) ans = roman[(i + t) % 12] print(ans)