I can't understand the solution

Solution - Exponentiation II (CSES) - here it says that thanks to Fermat’s Little Theoremap−1≡1(modp)a^{p - 1} \equiv 1 \pmod{p}ap−1≡1(modp)abc(mod1e9+7−1)(mod1e9+7)a^{b^c \pmod{1e9 + 7 - 1}} \pmod{1e9+7}abc(mod1e9+7−1)(mod1e9+7), but I can’t understand how b^c \pmod{1e9 + 7 - 1} was obtained through Fermat’s theorem.

Could you format your math properly?