L = list(input().split()) S1 = L[0] T = int(L[1]) List1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] List2 = ["I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"] Dict1 = dict(zip(List1, List2)) Dict2 = dict(zip(List2, List1)) if T == 0: dT = 0 else: dT = int((T / abs(T)) * (abs(T) % 12)) tempT = Dict2[S1] + dT if tempT == 0: tempT = 0 else: T = int((tempT / tempT) * (abs(tempT) % 12)) if T <= 0: T += 12 print(Dict1[T])