#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); vector f = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"}; string S; int T; cin >> S >> T; int pos = 0; for(int i = 0; i < 12; i++) if(f[i] == S) pos = i; cout << f[(pos + T % 12 + 12) % 12] << endl; }