//ゴミみたいなプログラムで本当申し訳ない

#include <iostream>
#include <string>
using namespace std;

int main() {
	string s1;
	int s = 0;
	int D = 0;
	int t;
	cin >> s1 >> t;
	if (s1 == "I") s = 1;
	else if (s1 == "II") s = 2;
	else if (s1 == "III") s = 3;
	else if (s1 == "IIII") s = 4;
	else if (s1 == "V") s = 5;
	else if (s1 == "VI") s = 6;
	else if (s1 == "VII") s = 7;
	else if (s1 == "VIII") s = 8;
	else if (s1 == "IX") s = 9;
	else if (s1 == "X") s = 10;
	else if (s1 == "XI") s = 11;
	else if (s1 == "XII") s = 0;

	D = (s + t + 1200) % 12;

	if (D == 1) cout << "I" << endl;
	if (D == 2) cout << "II" << endl;
	if (D == 3) cout << "III" << endl;
	if (D == 4) cout << "IIII" << endl;
	if (D == 5) cout << "V" << endl;
	if (D == 6) cout << "VI" << endl;
	if (D == 7) cout << "VII" << endl;
	if (D == 8) cout << "VIII" << endl;
	if (D == 9) cout << "IX" << endl;
	if (D == 10) cout << "X" << endl;
	if (D == 11) cout << "XI" << endl;
	if (D == 0) cout << "XII" << endl;

	return 0;
}