#include "bits/stdc++.h" using namespace std; const int romaNum[13] = {1000,900,500,400,100,90,50,40,10,9,5,4,1}; const char *romaChar[13] = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"}; inline string convertToRoma(int n){ if(n > 3999) return "ERROR"; int cnt; string ret; for(int i = 0; n ; ++i) { // cout << romaChar[i] << " = " << romaNum[i] << endl; cnt = n / romaNum[i]; for(int r = 0 ; r > N; while(N--) { cin >> R; ans += convertFromRoma(R); } cout << convertToRoma(ans) << endl; } int main(void){ ios::sync_with_stdio(0); cin.tie(0); Solve(); return 0; }