$b=<>;$n=<>;$s+=$_ for@c=<>; $a=$s/$n+.5|0; ++$a if $a*$n+$b<$s; $r+=abs($a-$_)for@c; print$r