Solution (source code)

= Solution

For finite second moments, the general <variance of a sum> formula is
$$
\boxed{\operatorname{Var}\left(\sum_{i=1}^nX_i\right)
=\sum_{i=1}^n\operatorname{Var}(X_i)+2\sum_{1\leq i<j\leq n}\operatorname{Cov}(X_i,X_j).}
$$
Each distinct unordered pair appears once in the second sum and twice when the full square is expanded. No independence assumption is needed.