#P5005. 中国象棋 - 摆上马

    ID: 3971 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>枚举,暴力状态压缩,状压进制

中国象棋 - 摆上马

Description

Imakf has a board with XX rows and YY 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 (109+7)(10^9+7).

Input Format

The first line contains two positive integers X,YX, Y.

Output Format

Output the number of ways modulo (109+7)(10^9+7).

1 1 

2
3 3 

145

Hint

For 100% of the data, 1X1001\le X\leq100, 1Y61\le Y\leq6.

For 20% of the data, X,Y6X, Y\leq6.

For another 20% of the data, X20X\leq20.

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