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