It is known that $a_1, a_2, a_3, ... , a_n \in \left\{-1, 1 \right\}$ and $S = a_1a_2a_3a_4 + a_2a_3a_4a_5 + ... + a_na_1a_2a_3 = 0$
Prove that $n \equiv 0\space(mod\space 4)$
I know this problem can be solved using number theory, but I am looking for a solution utilizing the concept of invariance.
I was able to identify an invariant of sorts: even if you change the sign of any $a_i$, the sum will still remain congruent to same number $mod \space 4$. It can be proved using this invariant that no matter what values you choose for each of the $a_i$, $S \equiv 0 \space (mod \space 4)$. It is not yet clear how I can prove the required statement using this result.
After some thought I got the answer: we can start changing the signs of each of the $a_i$ until all the $a_i$s are positive at which point $S ≡ 0 \space (mod \space 4)$, and $S = n$. Which proves the statement since $n ≡ 0 \space (mod \space 4)$