import java.util.*; class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String[] roma = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"}; String s = sc.next(); int n = sc.nextInt(); for (int i=0; i<12; i++) { if (s.equals(roma[i])) { System.out.println(roma[(i+n+1200)%12]); return; } } } }