#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef pair pii; typedef pair pll; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i) #define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i) #define DEBUG(x) cout<<#x<<": "< P; int main(){ map si; si["I"] = 1; si["II"] = 2; si["III"] = 3; si["IIII"] = 4; si["V"] = 5; si["VI"] = 6; si["VII"] = 7; si["VIII"] = 8; si["IX"] = 9; si["X"] = 10; si["XI"] = 11; si["XII"] = 12; string s; int n; cin>>s>>n; int tm = si[s] + n; tm = (tm%12+12)%12; if(tm==0)tm=12; map rev; for(auto p:si){ if(p.second == tm){ puts((p.first).c_str()); } } return 0; }