8. (1991 National High School Mathematics League Question) Let the set $M=\{1,2, \cdots, 1000\}$, and for any non-empty subset $X$ of $M$, let $a_{x}$ denote the sum of the largest and smallest numbers in $X$. Then, the arithmetic mean of all such $a_{x}$ is $\qquad$ .
8. For any subset $X=\left\{b_{1}, b_{2}, \cdots, b_{k}\right\}$ of set $M$, assuming $b_{1}<b_{2}<\cdots<b_{k}$, there must exist another subset $X^{\prime}=\left\{1001-b_{1}, 1001-b_{2}, \cdots, 1001-b_{k}\right\}$, at this time
$$
\begin{array}{l}
a_{x}=b_{1}+b_{k}, \\
a_{x^{\prime}}=\left(1001-b_{1}\right)+\left(1001-b_{k}\right)=2002-b_{1}-b_{k},
\end{array}
$$
the arithmetic mean of $a_{x}$ and $a_{x^{\prime}}$ is 1001.
Pairing the non-empty subsets of $M$, for each non-empty subset $X \subset M, X^{\prime}=\{1001-x \mid x \in X\}$, then $X^{\prime} \subset M$.
If $X \neq X^{\prime}$, then $a_{x}+a_{x^{\prime}}=2002$.
If $X \neq X^{\prime}$, then $a_{x}=1001$.
In summary, the arithmetic mean of all such $a_{x}$ is 1001.