m@main=getLine>>=print.sum.scanr1(!).map(maybe 1(*5).($zip"VXLCDM"[1,2,10,20,100,200]).lookup)>>m a!b|a