#include #include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); string hour[12] = { "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII" }; string S; int T; cin >> S >> T; for (int i = 0; i < 12;i++) { if (S == hour[i]) { if (T >= 0) { cout << hour[(i + T) % 12] << endl; return 0; } else { cout << hour[(i + 12 * (((-T) / 12) + 1) + T)%12] << endl; return 0; } } } return 0; }