import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00000405_Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static String[] romeArr = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"}; public static void main(String[] args) throws IOException { String[] arr = br.readLine().split(" "); System.out.println(romeArr[((getHH(arr[0]) + Integer.parseInt(arr[1]) % 12) + 12) % 12]); } private static int getHH(String s) { int ret = 0; for(int i = 0; i < 12; i++) { if(s.equals(romeArr[i])) { ret = i; break; } } return ret; } }