7. Given that $x_{1}, x_{2}, \cdots, x_{40}$ are all positive integers, and
$$
x_{1}+x_{2}+\cdots+x_{40}=58 \text {. }
$$

If the maximum value of $x_{1}^{2}+x_{2}^{2}+\cdots+x_{40}^{2}$ is $A$, and the minimum value is $B$, then $A+B=$ . $\qquad$
Hint: By gradual adjustment, we get $A+B=494$.