import java.util.*; import java.util.stream.Stream; public class No405 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int t = sc.nextInt(); List roma = Arrays.asList("I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"); System.out.println(roma.get((roma.indexOf(s) + t + 1200) % 12)); } }