import java.util.Scanner; public class b { public static void main(String args[]){ Scanner sc = new Scanner(System.in); String foo[] = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"}; String s = sc.next(); int t = sc.nextInt(); int i = 0; while(true){ if(foo[i].equals(s)) break; i++; } if(t >= 0) System.out.println(foo[(i + t) % 12]); else System.out.println(foo[(12 + ((i + t) % 12)) % 12]); } }