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