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