#include #include int main(void) { int i; char s1[1000]; char *s2[] = {"XII", "I","II","III","IIII","V","VI", "VII","VIII","IX","X","XI"}; int t; int k; scanf("%s%d",s1,&t); for(i=0;i<12;i++){ if(strstr(s1,s2[i])) break; } i+=t; i%=12; if(i<0){ i+=12; } printf("%s\n",s2[i]); return 0; }