#P8756. [蓝桥杯 2021 省 AB2] 国际象棋
[蓝桥杯 2021 省 AB2] 国际象棋
Problem Description
As everyone knows, the “Eight Queens” problem asks for the number of ways to place queens on a chessboard so that no two queens attack each other. Xiao Lan, who has learned many algorithms, thinks the “Eight Queens” problem is too easy and still wants more. As a chess fan, he wants to study the following: on an board, how many ways are there to place knights so that no two knights attack each other. Since the number of ways can be very large, you only need to compute the answer modulo (i.e., ).
As shown in the figure below, a knight in chess is placed inside a square and moves in an “L” shape. A knight located at square (row , column ) can attack the squares , , , , , , , .

Input Format
Input one line containing three positive integers , , and , representing the number of rows, the number of columns, and the number of knights.
Output Format
Output one integer, representing the number of valid placements modulo (i.e., ).
1 2 1
2
4 4 3
276
3 20 12
914051446
Hint
For of the testdata, .
For another of the testdata, .
For another of the testdata, .
For another of the testdata, , .
For another of the testdata, , , .
For all testdata, , , .
Lanqiao Cup 2021 Second Round Provincial Contest, Group A Problem I (Group B Problem J).
Translated by ChatGPT 5