I am trying to convert CIIXMXCVCII to decimal number. However, I am not getting it completely if it's a valid roman number representation or not. I tried this online tool: http://www.tools4noobs.com/online_tools/roman_decimal/ which says it's equivalent to 1277. However, roman representation of 1277 should be MCCLXXVII in my opinion. Can somebody clarify my doubt? Are both of these roman representation pointing to the same decimal number?
Thanks!
PS: Motivation for this comes from this mathematical joke:

The subtractive rule became “standard” only during the Middle Ages. But it's limited in application: only I, X and C can be used for subtraction (once) and next to a symbol of the “next size”:
(see http://en.wikipedia.org/wiki/Roman_numerals)
Thus $1999$ can be represented as MCMXCIX, not as MIM. The notation is in order from the highest units to the lowest:
that would be, without the abbrevations,
In Latin, the number would be spelled mille nongenti nonaginta novem and the number system reflected the names. So IM would mean nothing: Romans were not really good with arithmetic.
;)This can be found in modern usage, however.I can't see any sensible way to parse CIIXMXCVCII. The tool you mention converts MIIM into $2000$ and IMIIM into $1999$, so I'm under the impression that it discards “illegal” subtractive symbols; if we remove II (as CIIX is converted to $110$) we get CXMXCVCII: $100+990+90+5+100+2=1287$ so I don't see where $1277$ comes from. Another example is VVCVCIV that's converted to $199$, while removing the first C gives VVVCIV that's converted to $109$.