import java.util.Scanner;
class Teste {
public static void main
(String[] args
) {
Scanner teclado
= new Scanner
(System.
in);
int[] vaNum = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
String[] vaRom
= {"M",
"CM",
"D",
"CD",
"C",
"XC",
"L",
"XL",
"X",
"IX",
"V",
"IV",
"I"};
while (true) {
int numero = teclado.nextInt();
if (numero == 0) break;
System.
out.
printf("%-4d ", numero
); int i = 0;
while (numero > 0) {
if (numero >= vaNum[i]) {
numero -= vaNum[i];
} else {
i++;
}
}
}
}
}
aW1wb3J0IGphdmEudXRpbC5TY2FubmVyOwoKY2xhc3MgVGVzdGUgewoKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKCiAgICAgICAgU2Nhbm5lciB0ZWNsYWRvID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCiAgICAgICAgaW50W10gdmFOdW0gPSB7MTAwMCwgOTAwLCA1MDAsIDQwMCwgMTAwLCA5MCwgNTAsIDQwLCAxMCwgOSwgNSwgNCwgMX07CgogICAgICAgIFN0cmluZ1tdIHZhUm9tID0geyJNIiwgIkNNIiwgIkQiLCAiQ0QiLCAiQyIsICJYQyIsICJMIiwgIlhMIiwgIlgiLCAiSVgiLCAiViIsICJJViIsICJJIn07CgogICAgICAgIHdoaWxlICh0cnVlKSB7CgogICAgICAgICAgICBpbnQgbnVtZXJvID0gdGVjbGFkby5uZXh0SW50KCk7CiAgICAgICAgICAgIGlmIChudW1lcm8gPT0gMCkgYnJlYWs7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRmKCIlLTRkICIsIG51bWVybyk7CiAgICAgICAgICAgIGludCBpID0gMDsKICAgICAgICAgICAgd2hpbGUgKG51bWVybyA+IDApIHsKICAgICAgICAgICAgICAgIGlmIChudW1lcm8gPj0gdmFOdW1baV0pIHsKICAgICAgICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KHZhUm9tW2ldKTsKICAgICAgICAgICAgICAgICAgICBudW1lcm8gLT0gdmFOdW1baV07CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGkrKzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oKTsKICAgICAgICB9CiAgICB9Cn0=