print eval's/(M)|D/1x@-x5/ge;s/C1//;y/LXVIC1/DCLXM/;'x3,$/for<>