S1, T = list(map(int, input().split())) 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)) dT = int((T / abs(T)) * (abs(T) % 12)) tempT = Dict2[S1] + dT + 12 T = int((tempT / tempT) * (abs(tempT) % 12)) print(Dict1[T])