Let $z=7^{2018}-1$
Theorem. : Let $p \in \mathbb{N}$ be any prime and $a \in \mathbb{Z}$. If $p$ doesn't divide $a$, then $p$ divides $a^{p-1}-1$
$$ z=\left(7^{1009}\right)^2-1=\left(7^{1009}\right)^{3-1}-1 $$ For $p=3$ and $a=7^{1009}$ the theorem gives: $$ z \bmod 3=0 $$ Any hints on how to proceed to find $z \bmod 5$?
Note: Some kind of error occurred and the important part of the last sentence got deleted/never composed. I apologize for the ambiguity of my question in its previous form.