I know that I need to reduce $7^{12341} \pmod {1000}$
By Euler I have $7^{\phi(1000)}\equiv 7^{400}\equiv1\pmod{1000}$
That leaves me with the monster $7^{341}\pmod{1000}$
Is there a way to reduce this smoothly without working $7^2, 7^4, 7^8$ etc manually ?
$7^{20}=(7^5)^4=((16807)^2)^2\equiv((807)^2)^2\equiv(651249)^2\equiv249^2\equiv62001\equiv1\pmod {1000} $
Then we write $7^{341}=7*(7^{20})^{17}\equiv7*1^{17}\equiv7\pmod {1000}$