How prove this$\frac{(a_1 a_2\cdots a_n)^2-1}{8}\equiv\sum_{i=1}^n\frac{a^2_i -1}{8}\pmod 8$

let $a_1,a_2,\cdots,a_n$ is odd numbers,show that

$$\frac{(a_{1}a_{2}\cdots a_{n})^2-1}{8}\equiv\sum_{i=1}^{n}\dfrac{a^2_{i}-1}{8} \pmod 8$$

My idea: since $n=1$ then this is Obviously

$$\frac{a^2_{1}-1}{8}\equiv\dfrac{a^2_{1}-1}{8}\pmod 8$$

$n=2$

$$\dfrac{a^2_{1}a^2_{2}-1}{8}\equiv\dfrac{(2k-1)^2(2m-1)^2-1}{8}\equiv\frac{4k^2-4k+4m^2-4m}{8}=\dfrac{a^2_{1}+a^2_{2}-2}{8}\pmod 8?$$

where $a_{1}=2k-1,a_{2}=2m-1$ because $$(2k-1)(2m-1)^2-1=(4km-2k-2m+1)^2-1=(16k^2m^2-16k^2m-16km^2+8km+8km)+4k^2+4m^2-4k-4m+1-1$$ But for The general，I can't prove it

Thank you

-
Have you tried replacing $a_2$ by $a_2 \cdots a_n$ and do the same argument? –  Patrick Da Silva Feb 9 at 15:47
Yup, $n = 2$ is all you need. Then induction does the rest. –  Daniel Fischer Feb 9 at 15:47
If you write (\mod 8) you get $(\mod 8)$, but if you write \pmod 8 you get $\pmod 8$. (If there's more than one character after "mod", then you need braces: \pmod83 yields $\pmod83$, so write \pmod{83}, yielding $\pmod{83}$.) I edited the question accordingly. –  Michael Hardy Feb 9 at 18:31