There is a simple rule, whenever the same symbol is written four times, it is replaced by subtracting it from the next higher number (5,50,50,500). That way, IV is written instead of IIII (4), XL instead of XXXX (40), etc. It is used since about the Middle Ages. Usually only one number is subtracted, not two. So 18 is usually XVIII instead of IIXX. Also, the subtraction rule is only valid for the symbol which comes right beforehand in the sequence. This means that 99 is written XCIX, and not IC.