s,t=(str(i) for i in input().split()) t=int(t) answer='' number=['I','II','III','IV','V','VI','VII','VIII','IX','X','XI','XII'] for i in range(len(number)): if s==number[i]: answer=i+t if answer>11: print(number[answer-11]) else: print(number[answer])