#include <iostream>
#include <cstring>

using namespace std;

int ans, w, h;
int a[20][20];

void search(int pos){
	for(int i=pos;i<=w*h;i++){
		if(i==w*h) { ans++; return; }
		int x = i%w, y = i/w;
		if(a[x][y]!=-1) continue;
		if(x!=0&&y!=0&&a[x-1][y]!=a[x-1][y-1]&&a[x-1][y-1]!=a[x][y-1]) return;
		a[x][y] = i;
		if(y!=h-1&&a[x][y+1]==-1){
			a[x][y+1] = i;
			search(pos+1);
			a[x][y+1] = -1;
		}
		if(x!=w-1&&a[x+1][y]==-1){
			a[x+1][y] = i;
			search(pos+2);
			a[x+1][y]  = -1;
		}
		a[x][y] = -1;
		break;
	}
}

int main(){
	while(cin >> w >> h, w){
		memset(a, -1, sizeof(a));
		ans = 0;
		search(0);
		cout << ans << endl;
	}
	return 0;
}
### Prompt

Generate a Cpp solution to the following problem:

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 <iostream>
#include <cstring>

using namespace std;

int ans, w, h;
int a[20][20];

void search(int pos){
	for(int i=pos;i<=w*h;i++){
		if(i==w*h) { ans++; return; }
		int x = i%w, y = i/w;
		if(a[x][y]!=-1) continue;
		if(x!=0&&y!=0&&a[x-1][y]!=a[x-1][y-1]&&a[x-1][y-1]!=a[x][y-1]) return;
		a[x][y] = i;
		if(y!=h-1&&a[x][y+1]==-1){
			a[x][y+1] = i;
			search(pos+1);
			a[x][y+1] = -1;
		}
		if(x!=w-1&&a[x+1][y]==-1){
			a[x+1][y] = i;
			search(pos+2);
			a[x+1][y]  = -1;
		}
		a[x][y] = -1;
		break;
	}
}

int main(){
	while(cin >> w >> h, w){
		memset(a, -1, sizeof(a));
		ans = 0;
		search(0);
		cout << ans << endl;
	}
	return 0;
}
```