see gal one person has already told one way to get to the ans easily
but for beginers i would sugest the folowing way
u hv got 4^87 / 3
= 4.4.4. ..................4.4.4 87 times divided by 3
=4/3 4^86
=(1+ 1/3) 4^86
=4(1+1/3)4^85
=(4+4/3)4^85
=(4+1+1/3)4^85
=(5+1/3)4^85
=(20+4/3)4^84
=(21+1/3)4^84
...........................
..................
=(k+1/3) where k is a constant
hence remainder is 1
now try this one
its a bit tricky
5555^2222 + 2222^5555 when divided by seven gives remainder = ? ans is 0