#include #include int decode(std::string s) { if (s == "I") return 1; if (s == "II") return 2; if (s == "III") return 3; if (s == "IIII") return 4; if (s == "V") return 5; if (s == "VI") return 6; if (s == "VII") return 7; if (s == "VIII") return 8; if (s == "IX") return 9; if (s == "X") return 10; if (s == "XI") return 11; if (s == "XII") return 12; return 0; } std::string encode(int n) { if (n == 1) return "I"; if (n == 2) return "II"; if (n == 3) return "III"; if (n == 4) return "IIII"; if (n == 5) return "V"; if (n == 6) return "VI"; if (n == 7) return "VII"; if (n == 8) return "VIII"; if (n == 9) return "IX"; if (n == 10) return "X"; if (n == 11) return "XI"; if (n == 12) return "XII"; return ""; } int main() { std::string s; int n, t; std::cin >> s >> n; t = decode(s); if (n < 0) { n %= 12; n += 12; } t += n; if (t > 12) t %= 12; std::cout << encode(t) << std::endl; return 0; }