Modular arithmetic and powers

Suppose: $$a=(5^4 \pmod 7)^3 \pmod {13}$$

How would you go about solving this? The only thing I came up with is an ugly polynomial: $a=13k+7l^3+5^{12}$ but this doesn't tell me much. Any starting point would be great.

• hint: $(5^4 \pmod 7)=2$ – Salech Rubenstein Dec 6 '13 at 3:22
• gosh you're right – Dimitri Dec 6 '13 at 3:25

$$5^2\mod 7 = -3$$ $$5^4 \mod 7 = 2$$. $$2^3=8$$.