#include <bits/stdc++.h>
#include <string>
using namespace std;
/**
Convert decimal number lying between 1-3999 to roman numerals
SYMBOL VALUE
I 1
II 2
III 3
IV 4
V 5
X 10
L 50
C 100
D 500
M 1000
**/
vector<pair<int, string>> romanMapping = {
{1000, "M"}, {900, "CM"}, {500, "D"}, {400, "CD"},
{100, "C"}, {90, "XC"}, {50, "L"}, {40, "XL"},
{10, "X"}, {9, "IX"}, {5, "V"}, {4, "IV"}, {1, "I"}
};
string roman(int n){
string rom = "";
for(pair<int,string> &p : romanMapping) {
if(p.first < n) {
rom+= p.second;
rom+= roman(n%(p.first));
break;
}
}
return rom;
}
int main() {
int intNum = 0;
cin >> intNum;
cout << roman(intNum);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxzdHJpbmc+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgovKioKQ29udmVydCBkZWNpbWFsIG51bWJlciBseWluZyBiZXR3ZWVuIDEtMzk5OSB0byByb21hbiBudW1lcmFscwoKU1lNQk9MICAgICAgIFZBTFVFCkkgICAgICAgICAgICAgMQpJSQkJCSAgMgpJSUkJCQkgIDMKSVYgICAgICAgICAgICA0ClYgICAgICAgICAgICAgNQpYICAgICAgICAgICAgIDEwCkwgICAgICAgICAgICAgNTAKQyAgICAgICAgICAgICAxMDAKRCAgICAgICAgICAgICA1MDAKTSAgICAgICAgICAgICAxMDAwICAgICAKKiovCgp2ZWN0b3I8cGFpcjxpbnQsIHN0cmluZz4+IHJvbWFuTWFwcGluZyA9IHsKICAgIHsxMDAwLCAiTSJ9LCB7OTAwLCAiQ00ifSwgezUwMCwgIkQifSwgezQwMCwgIkNEIn0sCiAgICB7MTAwLCAiQyJ9LCB7OTAsICJYQyJ9LCB7NTAsICJMIn0sIHs0MCwgIlhMIn0sCiAgICB7MTAsICJYIn0sIHs5LCAiSVgifSwgezUsICJWIn0sIHs0LCAiSVYifSwgezEsICJJIn0KfTsKCnN0cmluZyByb21hbihpbnQgbil7CgkKCXN0cmluZyByb20gPSAiIjsKCWZvcihwYWlyPGludCxzdHJpbmc+ICZwIDogcm9tYW5NYXBwaW5nKSB7CgkJCgkJaWYocC5maXJzdCA8IG4pIHsKCQkJCgkJCXJvbSs9IHAuc2Vjb25kOwoJCQlyb20rPSByb21hbihuJShwLmZpcnN0KSk7CgkJCQoJCQlicmVhazsKCQl9Cgl9CgkKCXJldHVybiByb207CgkKCQp9CgppbnQgbWFpbigpIHsKCWludCBpbnROdW0gPSAwOwoJY2luID4+IGludE51bTsKCWNvdXQgPDwgcm9tYW4oaW50TnVtKTsKCXJldHVybiAwOwp9