P =raw_input() PP = P.split() S1 =str(PP[0]) T =int(PP[1]) L =[] L.append(S1) L.append(T) time={"I":1,"II":2,"III":3,"IIII":4,"V":5,"VI":6,"VII":7,"VIII":8,"IX":9,"X":10,"XI":11,"XII":12} time2={v:k for k,v in time.items()} A =time[L[0]]+L[1] if time[L[0]]+L[1]>12 or time[L[0]]+L[1]<12: A =(time[L[0]]+L[1])%12 print time2[A]