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