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