5 soldiers=10 legs (i)( a human has two legs)
5 big tigers per room,
number of rooms=5x5
So, number of legs of big tigers=5x5x5x4
number of small tigers=5x5x5x5
So, number of legs of small tigers=625x4
You are also standing in the palace.So You have 2 legs more.
Therefore total legs= 10 + 500 + 2500 + 2