40. Given that $a$ is a positive integer, the solution to the system of equations $\left\{\begin{array}{l}a x+y=-4 \\ 2 x+y=-2\end{array}\right.$ satisfies $x>0$, then $a=$
Answer: 3.

Solution: Solving the system of equations, we get
$$
\begin{array}{c}
\left\{\begin{array}{l}
x=\frac{2}{2-a} \\
y=\frac{8-2 a}{a-2}
\end{array}\right. \\
\left\{\begin{array}{l}
\frac{2}{2-a}0
\end{array},\right. \\
2<a<4,
\end{array}
$$

Solving, we get
Since $a$ is a positive integer,
Therefore,
$$
a=3 \text {. }
$$