1997-98 ACM North-Eastern European Regional Programming Contest
Problem F
Puncher

 source file puncher.cc

Puncher is a device with several needles for making holes in tickets. At the factory there is a rectangular template with M rows and N columns (the diagram below shows M=3 and N=4) to make different punchers with 1, 2, ... , M*N needles. The rows and columns of needles are perpendicular to each other, and the distance between the rows is equal to the distance between the columns. It is possible to make  2M*N - 1  different punchers in this way, since a puncher with no needles is not a puncher at all.

Sometimes it is not possible to distinguish tickets that are perforated by different punchers. Let us assume that -- whenever a ticket is punched -- two opposite borders of the ticket are parallel to the rows of the needles, and the other pair of opposite borders are parallel to the columns of the needles. The number of the holes in a perforated ticket is always equal to the number of the needles in the corresponding puncher. When perforating a ticket, any composition of the following transformations is allowed:

• a ticket may be perforated from either side (from the front or from the back),
• it may be inserted into the puncher with any of its four borders downwards (rotation by 0, 90, 180 and 270 degrees)
• the ticket may be translated parallel to any of its sides with respect to the puncher, as long as all of the puncher's needles do hit the ticket
Your task is to write a program to determine how many distinguishable punchers can be made with an M*N template. Two punchers are considered distinghuishable if it is impossible to match their perforation patterns using any combination of the operations described above.

Input

The input file consists of lines of two positive integers M ( <= 4 ) and N ( <= 8 ), separated by a single space.

Output

The output file consists of a single integer indicating the number of distinguishable punchers.

Sample input

`3 3`
`2 2`
`1 1`
Output for the sample input
`85`
`3`
`1`