#include <iostream>
#include <string>
#include <bits/stdc++.h>
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 n){
vector<int> num={1,4,5,9,10,40,50,90,100,400,500,900,1000};
vector<string> romann={"I","IV","V","IX","X","XC","L","XC","C","CD","D","CM","M"};
int i=12;
string ans="";
while(n>0){
int div=n/num[i];
n=n%num[i];
while(div--){
ans+=romann[i];
}
i--;
}
return ans;
}
int main() {
int intNum = 0;
cin >> intNum;
cout << roman(intNum);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCi8qKgpDb252ZXJ0IGRlY2ltYWwgbnVtYmVyIGx5aW5nIGJldHdlZW4gMS0zOTk5IHRvIHJvbWFuIG51bWVyYWxzCgpTWU1CT0wgICAgICAgVkFMVUUKSSAgICAgICAgICAgICAxCklJCQkJICAyCklJSQkJCSAgMwpJViAgICAgICAgICAgIDQKViAgICAgICAgICAgICA1ClggICAgICAgICAgICAgMTAKTCAgICAgICAgICAgICA1MApDICAgICAgICAgICAgIDEwMApEICAgICAgICAgICAgIDUwMApNICAgICAgICAgICAgIDEwMDAgICAgIAoqKi8Kc3RyaW5nIHJvbWFuKGludCBuKXsKCXZlY3RvcjxpbnQ+IG51bT17MSw0LDUsOSwxMCw0MCw1MCw5MCwxMDAsNDAwLDUwMCw5MDAsMTAwMH07Cgl2ZWN0b3I8c3RyaW5nPiByb21hbm49eyJJIiwiSVYiLCJWIiwiSVgiLCJYIiwiWEMiLCJMIiwiWEMiLCJDIiwiQ0QiLCJEIiwiQ00iLCJNIn07CglpbnQgaT0xMjsKCXN0cmluZyBhbnM9IiI7Cgl3aGlsZShuPjApewoJCWludCBkaXY9bi9udW1baV07CgkJbj1uJW51bVtpXTsKCQkKCQl3aGlsZShkaXYtLSl7CgkJCWFucys9cm9tYW5uW2ldOwoJCX0KCQlpLS07Cgl9CglyZXR1cm4gYW5zOwp9CgppbnQgbWFpbigpIHsKCWludCBpbnROdW0gPSAwOwoJY2luID4+IGludE51bTsKCWNvdXQgPDwgcm9tYW4oaW50TnVtKTsKCXJldHVybiAwOwp9