See the 2 X 2 board above. AekdyCoin gets a N X N chessboard recently. But he think the color of the chessman is too dull (Only White and Black!).So AekdyCoin buys different kind of chessmen with different color, say blue, pink, yellow …Now AekdyCoin buys K kind of chessmen with different color, and the number of each kind is exactly Ai.
Now AekdyCoin begins to play with these chessmen. He wants to put all the chessmen he bought on the board, and of course every grid could only contain one single chessman.The Figure 2 shows a valid situation ,in this figure, AekdyCoin bought two kind of chessmen and the number of each is one.
As we know, AekdyCoin is very clever. So he think about this question:What is the number of ways he could put all chessmen he bought on the N X N board?
After a several seconds , AekdyCoin gets a perfect idea about how to solve this problem. What about you?
Two situation are regard the same in Figure 3, but the different in Figure 4.
But the ways that you can get by flip or circumrotate is not regard as the same!