mod Distributive Law, factoring $\!\!\bmod\!\!:$ $\ ab\bmod ac = a(b\bmod c)$ I stumbled across this problem

Find $\,10^{\large 5^{102}}$ modulo $35$, i.e. the remainder left after it is divided by $35$

Beginning, we try to find a simplification for $10$ to get:
$$10 \equiv 3 \text{ mod } 7\\ 10^2 \equiv 2 \text{ mod } 7 \\ 10^3 \equiv 6 \text{ mod } 7$$
As these problems are meant to be done without a calculator, calculating this further is cumbersome. The solution, however, states that since $35 = 5 \cdot 7$, then we only need to find $10^{5^{102}} \text{ mod } 7$. I can see (not immediately) the logic behind this. Basically, since $10^k$ is always divisible by $5$ for any sensical $k$, then:
$$10^k - r = 5(7)k$$
But then it's not immediately obvious how/why the fact that $5$ divides $10^k$ helps in this case.
My question is, is in general, if we have some mod system with $a^k \equiv r \text{ mod } m$ where $m$ can be decomposed into a product of numbers $a \times b \times c \ \times ...$, we only need to find the mod of those numbers where $a, b, c.....$ doesn't divides $a$? (And if this is the case why?) If this is not the case, then why/how is the solution justified in this specific instance?
 A: First, note that $10^{7}\equiv10^{1}\pmod{35}$.
Therefore $n>6\implies10^{n}\equiv10^{n-6}\pmod{35}$.
Let's calculate $5^{102}\bmod6$ using Euler's theorem:


*

*$\gcd(5,6)=1$

*Therefore $5^{\phi(6)}\equiv1\pmod{6}$

*$\phi(6)=\phi(2\cdot3)=(2-1)\cdot(3-1)=2$

*Therefore $\color\red{5^{2}}\equiv\color\red{1}\pmod{6}$

*Therefore $5^{102}\equiv5^{2\cdot51}\equiv(\color\red{5^{2}})^{51}\equiv\color\red{1}^{51}\equiv1\pmod{6}$


Therefore $10^{5^{102}}\equiv10^{5^{102}-6}\equiv10^{5^{102}-12}\equiv10^{5^{102}-18}\equiv\ldots\equiv10^{1}\equiv10\pmod{35}$.
A: Carrying on from your calculation:
$$\begin{align}
10^3&\equiv 6 \bmod 7 \\
&\equiv -1 \bmod 7 \\
\implies 10^6 = (10^3)^2&\equiv 1 \bmod 7
\end{align}$$
We could reach the same conclusion more quickly by observing that $7$ is prime so by Fermat's Little Theorem, $10^{(7-1)}\equiv 1 \bmod 7$.
So we need to know the value of $5^{102}\bmod 6$, and here again $5\equiv -1 \bmod 6 $ so $5^{\text{even}}\equiv 1 \bmod 6$. (Again there are other ways to the same conclusion, but spotting $-1$ is often useful).
Thus $10^{\large 5^{102}}\equiv 10^{6k+1}\equiv 10^1\equiv 3 \bmod 7$.
Now the final step uses the Chinese remainder theorem for uniqueness of the solution (to congruence):
$$\left .\begin{align}
x&\equiv 0 \bmod 5 \\
x&\equiv 3 \bmod 7 \\
\end{align}
\right\}\implies x\equiv 10 \bmod 35 $$
