#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
**/
/*
3999 - MMMMCMXCIX -> 3000 + 900 + 90 + 9
*/
string roman(int num){
vector<int> n = {1000, 900, 500, 400,100, 90, 50, 40, 10, 9, 5, 4, 3, 2, 1};
vector<string> roman = {"M", "CM", "L", "CL", "C", "XC","L", "XL", "X", "IX","V", "IV", "III","II","I" };
string ans = "";
int i=0;
while(num>0) {
if(num>=n[i]) {
ans+=roman[i];
num-=n[i];
}
else i++;
}
return ans;
}
int main() {
int intNum = 0;
cin >> intNum;
cout << roman(intNum);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCi8qKgpDb252ZXJ0IGRlY2ltYWwgbnVtYmVyIGx5aW5nIGJldHdlZW4gMS0zOTk5IHRvIHJvbWFuIG51bWVyYWxzCgpTWU1CT0wgICAgICAgVkFMVUUKSSAgICAgICAgICAgICAxCklJCQkJICAyCklJSQkJCSAgMwpJViAgICAgICAgICAgIDQKViAgICAgICAgICAgICA1ClggICAgICAgICAgICAgMTAKTCAgICAgICAgICAgICA1MApDICAgICAgICAgICAgIDEwMApEICAgICAgICAgICAgIDUwMApNICAgICAgICAgICAgIDEwMDAgICAgIAoqKi8KCi8qCjM5OTkgLSBNTU1NQ01YQ0lYIC0+IDMwMDAgKyA5MDAgKyA5MCArIDkgCiovCgpzdHJpbmcgcm9tYW4oaW50IG51bSl7CgkKCXZlY3RvcjxpbnQ+IG4gPSB7MTAwMCwgOTAwLCA1MDAsIDQwMCwxMDAsIDkwLCA1MCwgNDAsIDEwLCA5LCA1LCA0LCAzLCAyLCAxfTsKCXZlY3RvcjxzdHJpbmc+IHJvbWFuICA9IHsiTSIs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