program rim; const w: array[1..7] of char=('I','V','X','L','C','D','M'); var a,i,j,x,n,d,f: integer; s,r,z: string; begin writeln('vvedit natur chislo'); readln(a); str(a,s); n:=length(s); r:=''; x:=1; for i:=n downto 1 do begin val(s[i],d,f); if d<4 then for j:=1 to d do r:=w[x]+r; if d=4 then r:=w[x]+w[x+1]+r; if d=5 then r:=w[x+1]+r; if (d<9) and (d>5) then begin z:=w[x+1]; for j:=1 to d-5 do z:=z+w[x]; r:=z+r; end; if d=9 then r:=w[x]+w[x+2]+r; x:=x+2; end; writeln(r); writeln; writeln; end.