#include using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector vint; typedef pair pint; #define rep(i, n) REP(i, 0, n) #define ALL(v) v.begin() , v.end() #define REP(i, x, n) for(int i = x; i < n; i++) int main(){ int x, now = 0; string s, t[12] = { "XII", "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI"}; cin >> s >> x; rep(i, 12){ if(t[i] == s) now = i; } if(x < 0) x = 12 - abs(x) % 12; else x = x % 12; cout << t[now + x] << endl; }