## Roman numerals

The Roman numeral system was used in Ancient Rome. The numbers consist of combinations of letters from the Latin alphabet representing the different values.

Roman numerals are based on seven symbols:

I = 1
V = 5
X = 10
L = 50
C = 100
D = 500
M = 1000

These letters can be combined according to the following rules:

If a letter of a lower value is written before a letter of greater value, it has to be subtracted from the letter of greater value.
For example, the Roman numeral IX is the same as 10(X) - 1(I) = 9

If a letter of lower value is written after a letter of greater value, it has to be added to the letter of greater value.
For example, the Roman numeral VII is the same as 5(V) + 1(I) + 1(I) = 7

You can never subtract a symbol of greater value from a symbol of lower value.

Only I, X and C can be written after a letter of greater value:
I can only be written after V and X
X can only be written after L and C
C can only be written D and M

V, L and D cannot be repeated.

A letter can only be written three times in a number.