#include #include #include #include #define REP(i, a, b) for (int i = int(a); i < int(b); i++) using namespace std; typedef long long int lli; int main() { string S; int T; cin >> S >> T; T %= 12; vector tm = {"I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"}; cout << tm[(T + find(begin(tm), end(tm), S) - begin(tm) + 12) % 12] << endl; return 0; }