use bigint; ($n,$a,$b)=glob<>; $z+=27720/++$d*$_*($b**$d-$a**$d)for<>; print$z/27720;