#include using namespace std; int main() { string s1; int t; cin >> s1 >> t; vector v(12); v = { "I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII" }; int x; for (int i = 0; i < 12; i++) { if (s1 == v.at(i)) { x = i + 1; break; } } t %= 12; x += t; if (x > 12) x -= 12; if (x < 0) x += 12; if (!x) x = 12; cout << v.at(x - 1) << endl; }