S1, T = list(input().split()) L = ["I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"] print(L[L.index(S1) + int(T) % 12])