Cover a board

You have an n×mn \times m board. In how many mays can you cover it with 1×21 \times 2 pieces?

Input

Input consists of nn and mm. Assume 2nm402 \le nm \le 40, and that nmnm is even.

Output

Print in lexicographical order all the ways to cover the board. To distinguish the pieces, the two cells of the same piece must have the same digit, and two adjacent pieces must have different digits. Apart from that, digits should be as small as possible. (See the sample output 3.) Print a blank line after every solution.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:17:20.713Z

© Jutge.org, 2006–2026.
https://jutge.org