#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { string N[12] = { "I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII" }; string S; cin >> S; int T; cin >> T; int n; for ( int i = 0; i < 12; i++ ) { if ( S == N[i] ) { n = i; break; } } n += T; n = n >= 0 ? n%12 : 12-(abs(n)%12); cout << N[n] << endl; return 0; }