import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.next(); int T = scan.nextInt(); scan.close(); int k = 0; if(s.equals("I")) { k = 1; }else if(s.equals("II")) { k = 2; }else if(s.equals("III")) { k = 3; }else if(s.equals("IIII")) { k = 4; }else if(s.equals("V")) { k = 5; }else if(s.equals("VI")) { k = 6; }else if(s.equals("VII")) { k = 7; }else if(s.equals("VIII")) { k = 8; }else if(s.equals("IX")) { k = 9; }else if(s.equals("X")) { k = 10; }else if(s.equals("XI")) { k = 11; }else if(s.equals("XII")) { k = 0; } String []ans = {"XII","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI"}; int i = T % 12; if(k + i > 11) { System.out.println(ans[k + i - 12]); }else if(k + i < 0) { System.out.println(ans[12 + (k + i)]); }else { System.out.println(ans[k + i]); } } }