#define _USE_MATH_DEFINES //M_PI(π),M_SQRT2(√2) #include //std::cout, std::cin #include //std::string,std::to_string(C++11) #include //std::vector #include //std::valarray #include //std::sort #include //localtime_s #include //abs #include //abs,std::pow,sqrt,sin,cos,round,floor,ceil #include //std::ifstream,std::ofstream #include //std::setprecision,std::setw,std::setfill #include //std::random(C++11) #include //std::accumulate #include //std::greater int main(void) { //test用 //std::ifstream in("123.txt"); //std::cin.rdbuf(in.rdbuf()); std::string S1; int T = 0, ans = 0; std::cin >> S1 >> T; if (S1 == "I") { ans = (1 + (12 + T % 12)) % 12; } else if (S1 == "II") { ans = (2 + (12 + T % 12)) % 12; } else if (S1 == "III") { ans = (3 + (12 + T % 12)) % 12; } else if (S1 == "IIII") { ans = (4 + (12 + T % 12)) % 12; } else if (S1 == "V") { ans = (5 + (12 + T % 12)) % 12; } else if (S1 == "VI") { ans = (6 + (12 + T % 12)) % 12; } else if (S1 == "VII") { ans = (7 + (12 + T % 12)) % 12; } else if (S1 == "VIII") { ans = (8 + (12 + T % 12)) % 12; } else if (S1 == "IX") { ans = (9 + (12 + T % 12)) % 12; } else if (S1 == "X") { ans = (10 + (12 + T % 12)) % 12; } else if (S1 == "XI") { ans = (11 + (12 + T % 12)) % 12; } else { ans = (12 + (12 + T % 12)) % 12; } std::string out; switch (ans) { case 0:out = "XII"; break; case 1:out = "I"; break; case 2:out = "II"; break; case 3:out = "III"; break; case 4:out = "IIII"; break; case 5:out = "V"; break; case 6:out = "VI"; break; case 7:out = "VII"; break; case 8:out = "VIII"; break; case 9:out = "IX"; break; case 10:out = "X"; break; case 11:out = "XI"; break; } std::cout << out << std::endl; }