S1, T = input().split() T = int(T) short = ['I', 'II', 'III', 'IIII', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII'] for i in range(len(short)): if (S1 == short[i]): n1 = i n2 = n1 + T if (n2 > 11): n2 %= 12 print(short[n2])