I don't know how it works, although I learn it by myself. I need to find the last three digit number 3^3^3^3.... power of 3 is reapeted 2016 times. First of all, I calculated the Totient function for 1000. φ(1000)=400 after many calculations I've get this
3^187≡? (mod 1000)
Admittedly, I read a few books and article, but I still don't know how to overcome this obstecles.