#include <iostream> #include <string> #include <vector> using namespace std; int main(void){ vector<string> rome={ " ","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII" }; string s1; int t,jikan,ans; cin >> s1 >> t; for(int i=1;i<=12;i++) if(s1==rome[i]){ jikan=i; break; } ans=jikan+t+1008;ans%=12; if(ans==0) ans=12; cout << rome[ans] << endl; }