There are two kinds of lego bricks, characterized by their dimensions:
A lego brick is always used in upright position. The faces on the sides are made from identical material and are indistinguishable, except their dimensions.
We consider two lego bricks to be locked if one is directly above the other. Two bricks
You would like to build a thin rectangular wall with width
On the other hand, the following
How many ways of building a connected wall with no holes are there? Since this number may be large, output it modulo
Note that the mirrored (180-degree rotated) version of a lego wall is considered to be a different wall, unless the mirrored wall looks identical to the original wall.
Input Specification
The input consists of a single line containing two space separated integers
Output Specification
Output a single integer – the number of hole-free connected lego walls of dimensions
Sample Input 1
2 2
Sample Output 1
3
Sample Input 2
3 3
Sample Output 2
12
Sample Input 3
5 7
Sample Output 3
1436232
Explanation for Sample Input 1
The three connected
Constraints
- Subtask 1 (14 points):
. - Subtask 2 (12 points):
. - Subtask 3 (18 points):
. - Subtask 4 (30 points):
. - Subtask 5 (20 points):
. - Subtask 6 (6 points): no additional constraints.
Comments