def main(): d = {"I":1 ,"II":2,"III":3,"IIII":4,"V":5,"VI":6,"VII":7,"VIII":8,"IX":9,"X":10,"XI":11,"XII":12} d2 = {1:"I",2:"II",3:"III",4:"IIII",5:"V",6:"VI",7:"VII",8:"VIII",9:"IX",10:"X",11:"XI",12:"XII"} val1, val2 = input().split() current_hour = d[val1] after_hour = current_hour + int(val2) if after_hour == 0: print("I"); elif after_hour > 0: ans = after_hour % 12 if ans == 0: print("XII") else: print(d2[ans]) else: while after_hour >= 0: after_hour += 12 ans = after_hour % 12 if ans == 0: print("XII") else: print(d2[ans]) if __name__ == '__main__': main()