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