H = ["XII","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI"] W,T = gets.chomp.split n = H.index(W) puts H[(n + T.to_i) % 12]