import java.util.Scanner; public class Main { static String[] ti = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"}; public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S1 = sc.next(); int t = sc.nextInt(); int a = 0; for(int i = 0; i < ti.length; i++) { if(S1.equals(ti[i])) { a = i+1; break; } } a += t; a %= 12; if(a <= 0) a += 12; a -= 1; if(a == 0) a = 0; System.out.println(ti[a]); } }