4. Let the sequence $\left\{a_{n}\right\}$ have the sum of the first $n$ terms $S_{n}$ satisfying: $S_{n}+a_{n}=\frac{n-1}{n(n+1)}, n=1,2, \mathrm{~L}$, then the general term $a_{n}=$ $\qquad$
4. $a_{n}=\frac{1}{2^{n}}-\frac{1}{n(n+1)}$

Analysis:
$$
a_{n+1}=S_{n+1}-S_{n}=\frac{n}{(n+1)(n+2)}-a_{n+1}-\frac{n-1}{n(n+1)}+a_{n}=\frac{-2}{(n+1)(n+2)}+\frac{1}{n(n+1)}-a_{n+1}+a_{n}
$$

Thus, $2\left(a_{n+1}+\frac{1}{(n+1)(n+2)}\right)=a_{n}+\frac{1}{n(n+1)}$. Let $b_{n}=a_{n}+\frac{1}{n(n+1)}, b_{1}=\frac{1}{2}\left(a_{1}=0\right)$, therefore $b_{n+1}=\frac{1}{2} b_{n}, b_{n}=\frac{1}{2^{n}}$, so $a_{n}=\frac{1}{2^{n}}-\frac{1}{n(n+1)}$