#include #define REP(i,n) for(int i=0; i<(n); i++) using namespace std; struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; int main() { string S; int T; cin >> S >> T; vector vc{"XII","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI"}; int res{}; REP( i, 12 ) { if( S == vc[i] ) { res = i; } } int j = (res+T)%12; cout << ( j == 0 || T >= -1 || res - j > 0 ? vc[j] : vc[12+(j)] ) << endl; return 0; }