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