#define _USE_MATH_DEFINES #include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair #include //deque #include //INT_MAX #include //bitset #include //sqrt, ceil. M_PI, pow, sin #include //fixed #include //setprecision #include //stringstream #include //gcd, assumlate #include //randam_device #include //numeric_limits using namespace std; constexpr long long int D_MOD = 1000000007; inline int RomanToArabic(const string A) { //ローマ数字をアラビア数字に変換(1~12),4は'IIII' vector R = { "I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII" }; int i = 0; for (; i < 12; i++) { if (R[i] == A) { return(i + 1); } } return(0); } inline string ArabicToRoman(const int A) { //アラビア数字をローマ数字に変換(1~12),4は'IIII' vector R = { "I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII" }; if (1 <= A && A <= 12) { return (R[A - 1]); } else { return("False"); } } int main() { string S1; cin >> S1; int a = RomanToArabic(S1); int T; cin >> T; a = a + T; a = a % 12; if (a < 0) { a = a + 12; } if (a == 0) { a = 12; } cout << ArabicToRoman(a) << endl; return 0; }