[tex]\frac{n^2+n+4}{n+1} \ \in Z \ \ ===\ \textgreater \ n+1|n^2+n+4 \ \ \ \wedge n+1|n+1 \\\\\\ n+1|(n+1)^2 \ \ \textless \ =\ \textgreater \ \ n+1|n^2+2n+1 \\\\\\ n+1| n^2+2n+1-n^2-n-4 \\\\ n+1|n-3 \\ n+1|n+1 \\\\\\ n+1|n+1-n+4 \\\\ n+1|5 \ \ ===\ \textgreater \ n+1 \in \{ \pm1; \pm 5\} \\\\\\ 1)n+1=-1 \to n=-2 \\\\ 2) n+1=1 \to n=0 \\\\ 3) n+1=-5 \to n=-6 \\\\ 4) n+1=5 \to n=4 \\\\\\ \boxed{S \in \{ -6;-2;0;4 \}}[/tex]