#include using namespace std; int main() { string S; int N; cin >> S >> N; vector V(12); V = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"}; for (int i = 0; i < 12; i++) if (i + N >= 0 && V.at(i) == S) cout << V.at((i + N) % 12) << "\n"; else if (i + N < 0 && V.at(i) == S) cout << V.at(12 + (i + N) % 12) << "\n"; }