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