#include <iostream>
#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
**/
string roman(int num){
vector<pair<int,string>> mapping{
{1000,"M"},{500,"D"},
{100,"C"},{50,"L"},
{10,"X"},{5,"V"},
{4,"VI"},{1,"I"}
};
string res="";
for(const auto & [value,sym]:mapping){
if(num==0){
break;
}
while(num>=value){
res+=sym;
num-=value;
}
}
return res;
}
int main() {
int intNum = 0;
cin >> intNum;
cout << roman(intNum);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KI2luY2x1ZGUgPHN0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCi8qKgpDb252ZXJ0IGRlY2ltYWwgbnVtYmVyIGx5aW5nIGJldHdlZW4gMS0zOTk5IHRvIHJvbWFuIG51bWVyYWxzCgpTWU1CT0wgICAgICAgVkFMVUUKSSAgICAgICAgICAgICAxCklJCQkJICAyCklJSQkJCSAgMwpJViAgICAgICAgICAgIDQKViAgICAgICAgICAgICA1ClggICAgICAgICAgICAgMTAKTCAgICAgICAgICAgICA1MApDICAgICAgICAgICAgIDEwMApEICAgICAgICAgICAgIDUwMApNICAgICAgICAgICAgIDEwMDAgICAgIAoqKi8Kc3RyaW5nIHJvbWFuKGludCBudW0pewoJdmVjdG9yPHBhaXI8aW50LHN0cmluZz4+IG1hcHBpbmd7CgkJezEwMDAsIk0ifSx7NTAwLCJEIn0sCgkJezEwMCwiQyJ9LHs1MCwiTCJ9LAoJCXsxMCwiWCJ9LHs1LCJWIn0sCgkJezQsIlZJIn0sezEsIkkifQoJfTsKCQoJc3RyaW5nIHJlcz0iIjsKCQoJZm9yKGNvbnN0IGF1dG8gJiBbdmFsdWUsc3ltXTptYXBwaW5nKXsKCQlpZihudW09PTApewoJCQlicmVhazsKCQl9CgkJd2hpbGUobnVtPj12YWx1ZSl7CgkJCXJlcys9c3ltOwoJCQludW0tPXZhbHVlOwoJCX0KCQkKCX0KCQoJcmV0dXJuIHJlczsKCQp9CgppbnQgbWFpbigpIHsKCWludCBpbnROdW0gPSAwOwoJY2luID4+IGludE51bTsKCWNvdXQgPDwgcm9tYW4oaW50TnVtKTsKCXJldHVybiAwOwp9