import java.util.*; class y405 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int o, t=sc.nextInt(); String[] r={"XII","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI"}; for (o=0; o<12; o++) if (s.equals(r[o])) break; o=(((o+t)%12)<0?((o+t)%12+12):(o+t)%12); System.out.println(r[o]); } }