cl=["I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"] nw,af=input().split() pre=cl.index(nw) now=(int(af)+pre)%12 print(cl[now])