759 - The Return of the Roman Empire

Input and Output

寫一支程式把羅馬數字轉換成十進位的阿拉伯數字。

以下是羅馬數字代表的代號:$I=1$、$V=5$、$X=10$、$L=50$、$C=100$、$D=500$、$M=1000$,此外還有一些兩個字合體的代號:$IV=4$、$IX=9$、$XL=40$、$XC=90$、$CD=400$、$CM=900$。

請記得,這支程式必須排除不合理的羅馬數字。

Sample Input

MCMXCVIII
CCM

Sample Output

1998
This is not a valid number