S = input().split() a = S[0] b = int(S[1])-1 L = ["I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"] now = L.index(a) ans = L[(now+b) % 12 + 1] print(ans)