S1,T = map(str,input().split()) d = {"I":1,"II":2,"III":3,"IIII":4,"V":5,"VI":6,"VII":7,"VIII":8,"IX":9,"X":10,"XI":11,"XII":0} for key,value in d.items(): if value == d[S1] + int(T) % 12: print(key) break