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