S,T=input().split() X=["XII","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI"] T=int(T) k=X.index(S) print(X[(k+T)%12])