s,t=input().split();a=0;t=int(t) for x in s:a+=5 if x=='V' else 10 if x =='X' else 1 a=(a+t)%12;print('X'*(a>9)+'V'*((a-10)>4)+'I'*(a%5))