import java.util.*; class test{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String S1 = sc.next(); int def = 0; int sum = 0; int T = sc.nextInt(); if(S1.equals("I")){ def = 1; } else if(S1.equals("II")){ def = 2; } else if(S1.equals("III")){ def = 3; } else if(S1.equals("IIII")){ def = 4; } else if(S1.equals("V")){ def = 5; } else if(S1.equals("VI")){ def = 6; } else if(S1.equals("VII")){ def = 7; } else if(S1.equals("VIII")){ def = 8; } else if(S1.equals("IX")){ def = 9; } else if(S1.equals("X")){ def = 10; } else if(S1.equals("XI")){ def = 11; } else if(S1.equals("XII")){ def = 12; } while(def >= 12){ def -= 12; } while(def <= -12){ def += 12; } while(T >= 12){ T -= 12; } while(def <= -12){ T += 12; } sum = def + T; while(sum >= 12){ sum -= 12; } while(sum < 0){ sum += 12; } if(sum == 0){ System.out.println("XII"); } else if(sum == 1){ System.out.println("I"); } else if(sum == 2){ System.out.println("II"); } else if(sum == 3){ System.out.println("III"); } else if(sum == 4){ System.out.println("IV"); } else if(sum == 5){ System.out.println("V"); } else if(sum == 6){ System.out.println("VI"); } else if(sum == 7){ System.out.println("VII"); } else if(sum == 8){ System.out.println("VIII"); } else if(sum == 9){ System.out.println("IX"); } else if(sum == 10){ System.out.println("X"); } else if(sum == 11){ System.out.println("XI"); } } }