$n=<>;$s=<>;$t=<>; $x=$s=~y/2//; $y=$t=~y/2//; if($x|$y){ print+($x+$y)*$n-$x*$y; }else{ $x=$s=~y/1//+0; $y=$s=~y/1//+0; print$x>$y?$x:$y; }