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