#include using namespace std; int main() { string S1; int T; cin >> S1 >> T; string t[12] = { "I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII" }; int st = 0; for( int i = 0; i < 12; i++ ) { if( t[i] == S1 ) st = i; } int idx = T % 12; if( T < 0 ) idx = 12 - -T % 12; string ans = t[(st + idx) % 12]; cout << ans << endl; }