You have a n x n board and several checkers of different colors. The i-th element of checkers is the number of checkers you have of color i. You want to place all of the checkers on the board in such a way that no cell contains more than one checker.
Return the number of different possible placements modulo 1234567891. Two placements are equal if you can get one from the other by rotating the board. Note that checkers of the same color are indistinguishable. If you have more checkers than the number of cells on the board, there are no possible placements, so you should return 0.
|