#P5005. 中国象棋 - 摆上马
中国象棋 - 摆上马
Description
Imakf has a board with rows and columns, and many identical horses (you may assume there are infinitely many). Now place horses on the board (or place none). Find the total number of ways such that no horse can attack another horse.
The horse in Chinese chess is different from the knight in international chess.

Note: In the actual problem, there are no pawns.
Since the number of ways may be too large, output the value modulo .
Input Format
The first line contains two positive integers .
Output Format
Output the number of ways modulo .
1 1
2
3 3
145
Hint
For 100% of the data, , .
For 20% of the data, .
For another 20% of the data, .
For Sample 1, you may choose to place none or place horses.
For Sample 2, I have a brilliant explanation, but unfortunately I cannot fit it here.
Translated by ChatGPT 5
京公网安备 11011102002149号