#include <cstdio>
#include <vector>

using namespace std;

int H, W;

inline bool hantei(vector<vector<int> > tatami)
{
	bool ok = true;

	for (int k = 0; k < H - 1; k++)
	{
		for (int l = 0; l < W - 1; l++)
		{
			int c1 = tatami[k][l];
			int c2 = tatami[k][l + 1];
			int c3 = tatami[k + 1][l];
			int c4 = tatami[k + 1][l + 1];

			bool ok2 = !(c1 > 0 && c2 > 0 && c3 > 0 && c4 > 0 && c1 != c2 && c1 != c3 && c1 != c4 && c2 != c3 && c2 != c4 && c3 != c4);

			ok = ok && ok2;
		}
	}

	return ok;
}

inline int dfs(int count_, vector<vector<int> > tatami)
{
	if ((count_ - 1) * 2 == H * W)
	{
		return 1;
	}

	int sum = 0;

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (!tatami[i][j])
			{
				if (H - i - 1)
				{
					if (!tatami[i + 1][j])
					{
						vector<vector<int> > tatami2(tatami.begin(), tatami.end());

						tatami2[i][j] = count_; tatami2[i + 1][j] = count_;

						if (!hantei(tatami2)) { return 0; }

						sum += dfs(count_ + 1, tatami2);
					}
				}

				if (W - j - 1)
				{
					if (!tatami[i][j + 1])
					{
						vector<vector<int> > tatami2(tatami.begin(), tatami.end());

						tatami2[i][j] = count_; tatami2[i][j + 1] = count_;

						if (!hantei(tatami2)) { return 0; }

						sum += dfs(count_ + 1, tatami2);
					}
				}

				return sum;
			}
		}
	}

	return 0;
}

int main()
{
	while (true)
	{
		scanf("%d", &H);
		scanf("%d", &W);

		if (H == 0 && W == 0) { break; }

		if (H % 2 == 1 && W % 2 == 1)
		{
			printf("0\n");
		}
		else if (H == 1 || W == 1)
		{
			printf("1\n");
		}
		else if (H == W)
		{
			printf("2\n");
		}
		else
		{
			vector<vector<int> > start(H, vector<int>(W, 0));

			printf("%d\n", dfs(1, start));
		}
	}

	return 0;
}
### Prompt

Construct a CPP code solution to the problem outlined:

A tatami mat, a Japanese traditional floor cover, has a rectangular form with aspect ratio 1:2. When spreading tatami mats on a floor, it is prohibited to make a cross with the border of the tatami mats, because it is believed to bring bad luck.

Your task is to write a program that reports how many possible ways to spread tatami mats of the same size on a floor of given height and width.



Input

The input consists of multiple datasets. Each dataset cosists of a line which contains two integers H and W in this order, separated with a single space. H and W are the height and the width of the floor respectively. The length of the shorter edge of a tatami mat is regarded as a unit length.

You may assume 0 < H, W ≤ 20.

The last dataset is followed by a line containing two zeros. This line is not a part of any dataset and should not be processed.

Output

For each dataset, print the number of possible ways to spread tatami mats in one line.

Example

Input

3 4
4 4
0 0


Output

4
2

### Response

```cpp
#include <cstdio>
#include <vector>

using namespace std;

int H, W;

inline bool hantei(vector<vector<int> > tatami)
{
	bool ok = true;

	for (int k = 0; k < H - 1; k++)
	{
		for (int l = 0; l < W - 1; l++)
		{
			int c1 = tatami[k][l];
			int c2 = tatami[k][l + 1];
			int c3 = tatami[k + 1][l];
			int c4 = tatami[k + 1][l + 1];

			bool ok2 = !(c1 > 0 && c2 > 0 && c3 > 0 && c4 > 0 && c1 != c2 && c1 != c3 && c1 != c4 && c2 != c3 && c2 != c4 && c3 != c4);

			ok = ok && ok2;
		}
	}

	return ok;
}

inline int dfs(int count_, vector<vector<int> > tatami)
{
	if ((count_ - 1) * 2 == H * W)
	{
		return 1;
	}

	int sum = 0;

	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (!tatami[i][j])
			{
				if (H - i - 1)
				{
					if (!tatami[i + 1][j])
					{
						vector<vector<int> > tatami2(tatami.begin(), tatami.end());

						tatami2[i][j] = count_; tatami2[i + 1][j] = count_;

						if (!hantei(tatami2)) { return 0; }

						sum += dfs(count_ + 1, tatami2);
					}
				}

				if (W - j - 1)
				{
					if (!tatami[i][j + 1])
					{
						vector<vector<int> > tatami2(tatami.begin(), tatami.end());

						tatami2[i][j] = count_; tatami2[i][j + 1] = count_;

						if (!hantei(tatami2)) { return 0; }

						sum += dfs(count_ + 1, tatami2);
					}
				}

				return sum;
			}
		}
	}

	return 0;
}

int main()
{
	while (true)
	{
		scanf("%d", &H);
		scanf("%d", &W);

		if (H == 0 && W == 0) { break; }

		if (H % 2 == 1 && W % 2 == 1)
		{
			printf("0\n");
		}
		else if (H == 1 || W == 1)
		{
			printf("1\n");
		}
		else if (H == W)
		{
			printf("2\n");
		}
		else
		{
			vector<vector<int> > start(H, vector<int>(W, 0));

			printf("%d\n", dfs(1, start));
		}
	}

	return 0;
}
```