4. The function $f(x)=a \cos x+b \sin x$, where $a, b$ are real constants. If there exist $x_{1}$, $x_{2}$, and $x_{1} \neq x_{2}+k \pi \quad(k \in Z)$, such that $\left|f\left(x_{1}\right)\right|+\left|f\left(x_{2}\right)\right|=0$ holds, then the range of the function $f(x)$ is $\qquad$.
$\{0\} ;$