sub roman_to_dec { reduce { $a+$b-$a%$b*2 } map 'M1000D500C100L50X10V5I1' =~ /$_(\d+)/i, split//, pop }