Find remainder when $20^{13}$ is divided by $4940$
I have solved this, but am hoping for an elegant solution.
My solution:
$r(20^{13}||4940) = 20 \times r(20^{12}||247)$ where $r(a||b)$ is the remainder when $a$ is divided by $b$.
$20^3 \equiv 96 \mod 247 $
$20^6 \equiv 77 \mod 247 $
$20^{12} \equiv 1 \mod 247 $
So my answer is $20$.
But there must be a better way (This seems kind of brute force).
Any hints are welcome.