#include #include int main(){ char s[4]; int t,x; scanf("%s",s); scanf("%d",&t); if(strcmp(s,"I")==0)x=1; else if(strcmp(s,"II")==0)x=2; else if(strcmp(s,"III")==0)x=3; else if(strcmp(s,"IIII")==0)x=4; else if(strcmp(s,"V")==0)x=5; else if(strcmp(s,"VI")==0)x=6; else if(strcmp(s,"VII")==0)x=7; else if(strcmp(s,"VIII")==0)x=8; else if(strcmp(s,"IX")==0)x=9; else if(strcmp(s,"X")==0)x=10; else if(strcmp(s,"XI")==0)x=11; else if(strcmp(s,"XII")==0)x=0; if(t<0){ while(t<=0)t+=12; } t=(t+x)%12; if(t==1)printf("I\n"); else if(t==2)printf("II\n"); else if(t==3)printf("III\n"); else if(t==4) printf("IIII\n"); else if(t==5)printf("V\n"); else if(t==6)printf("VI\n"); else if(t==7)printf("VII\n"); else if(t==8)printf("VIII\n"); else if(t==9)printf("IX\n"); else if(t==10)printf("X\n"); else if(t==11)printf("XI\n"); else printf("XII\n"); }