5. Real numbers $a, b$ satisfy $|a| \leqslant 1,|a+b| \leqslant 1$, then the range of $(a+1)(b+1)$ is
A. $\left[0, \frac{9}{4}\right]$
B. $\left[-2, \frac{9}{4}\right]$
C. $[0,2]$
D. $[-2,2]$
Let $a=x, a+b=y$, then $(a+1)(b+1)=(x+1)(y-x+1)=-x^{2}+x y+y+1$ $=-\left(x-\frac{y}{2}\right)^{2}+\left(\frac{y}{2}+1\right)^{2}$, when $x=\frac{y}{2}, y=1$, $(a+1)(b+1)_{\text {max }}=\frac{9}{4}$, $x=1, y=-1$ when, $(a+1)(b+1)_{\text {min }}=-2$, so the answer is $B$.