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