You = 2
King = 2
5 Queens = 5 X 2 = 10
5 X 5 = 25
There are 25 rooms belonging to Queens.
25 X 5 = 125
There are 125 big cats.
125 X 5 = 625
There are 625 little cats.
625 + 125= 750
There are 750 cats in total.
750 cats = 750 X 4 = 3000
Total legs = 2 + 2 + 10 + 3000 = 3014
There are 3014 legs in the palace.