Evaluate the integral $$\int_{\gamma} \frac{z^2+1}{(z+1)(z+4)}dz$$ if $\gamma = \beta + [4 \pi ,0]$ and $\beta(t) = te^{it}$ for $0 \le t \le 4 \pi$.
My attempt
By Cauchy's integral formula.
\begin{align} \int_{\gamma} \frac{z^2+1}{(z+1)(z+4)}dz &= -\frac{1}{3} \int_{\gamma} \frac{z^2+1}{(z+4)}dz + \frac{1}{3} \int_{\gamma} \frac{z^2+1}{(z+1)}dz \\ &= -\frac{1}{3} (2\pi i)f(-4) + \frac{1}{3} (2\pi i)f(-1) \\ &= -10\pi i \end{align}
I'm not sure whether this is the correct method. Any help is appreciated.
Let $f(z)\to \frac{z^2+1}{(z+1)(z+4)}$
Then $$I_1=2\pi i\cdot \text{Res}_{-1}(f(z))=\frac{4}{3}\pi i$$ and $$I_2=2\pi i\cdot \text{Res}_{-4}(f(z))=-\frac{34}{3}\pi i$$
The total integral then is $$2I_1+I_2=-\frac{26}{3}\pi i$$
because the pole $z=-1$ is circled twice by $\gamma$ .