Yeongseon can use as many blocks of size 1×1×1, 1×1×2, and 1×1×3 as she wants. She also has one block of size 1×1×w, which is called the base block.

Yeongseon builds a structure from one base block and the other blocks. Every block must be connected to the base block, and no block can be placed at a non-integer position. A long block (1×1×2 or 1×1×3) must have both of its ends resting on other blocks. For a 1×1×3 block, the cell under its middle part may be empty.
The picture on the left is a valid structure. The picture on the right cannot be built.


The height of a structure is the number of layers stacked on top of the base block. The structure with no block at all has height 0, and it counts as one structure.
Given the length w of the base block and the height limit h, write a program that counts the structures of height at most h that can be built from one base block and an unlimited number of the other blocks.
The picture below shows all 84 structures for w=3 and h=2.
