#include "iostream" using namespace std; char c[12][10] = {"I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"}; char now[10]; int now_t; int t; int main() { cin >> now >> t; for (int i = 0; i < 12; i++) { for (int j = 0; j < 10; j++) { if (now[j] != c[i][j])break; if (j == 9)now_t = i; } } now_t += 12000; now_t += t; cout << c[now_t % 12]<<"\n"; return 0; }