Let f(x)=\left(x^{2}+3 x+2\right)^{\cos (\pi x)}. Find the sum of all positive integers n for which

\left|\sum_{k=1}^{n} \log _{10} f(k)\right|=1

Let f(x)=\left(x^{2}+3 x+2\right)^{\cos (\pi x)}. Find the sum of all positive integers n for which

\left|\sum_{k=1}^{n} \log _{10} f(k)\right|=1