#K66642. Roman Numerals to Integer Conversion

    ID: 32466 Type: Default 1000ms 256MiB

Roman Numerals to Integer Conversion

Roman Numerals to Integer Conversion

Given a Roman numeral, convert it to its integer representation. The roman numeral input will use the following symbols:
I = 1, V = 5, X = 10, L = 50, C = 100, D = 500, M = 1000.

The numeral is read from left to right, with the understanding that if a numeral of smaller value appears before one of larger value, it should be subtracted. Otherwise, it is added. For example, the numeral MCMXCIV is evaluated as follows:

\( M + (CM) + (XC) + (IV) = 1000 + 900 + 90 + 4 = 1994 \)

Your task is to implement this conversion.

inputFormat

The input consists of a single line containing a valid Roman numeral string.

outputFormat

Output a single integer number which is the value of the given Roman numeral.

## sample
III
3

</p>