#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;

int ans;
int h, w;
int ttm[30][30];
int c;

bool ok(int x, int y){
    return x==0 ||
        y==0 ||
        ttm[y][x]==ttm[y][x-1] ||
        ttm[y][x-1]==ttm[y-1][x-1] ||
        ttm[y-1][x-1]==ttm[y-1][x] ||
        ttm[y-1][x]==ttm[y][x];
}

void dfs(int x, int y){
    if(x==w){
    if(y==h-1){
            ans++;
            return;
        }
        else dfs(0,y+1);
        return;
    }

    if(ttm[y][x]) dfs(x+1,y);
    else{
        if(x+1!=w && ttm[y][x+1]==0){
            ttm[y][x] = ttm[y][x+1] = c++;
            if(ok(x,y)) dfs(x+2,y);
            ttm[y][x] = ttm[y][x+1] = 0;
        }
        if(y+1!=h && ttm[y+1][x]==0){
            ttm[y][x] = ttm[y+1][x] = c++;
            if(ok(x,y)) dfs(x+1,y);
            ttm[y][x] = ttm[y+1][x] = 0;
        }
    }
}
int main(){
    while(cin >> h >> w && h){
        ans = 0;
        c = 1;
        memset(ttm,0,sizeof(ttm));
        dfs(0, 0);
        cout << ans << endl;
    }
}
### Prompt

Please formulate 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 <algorithm>
#include <vector>
#include <cstring>
using namespace std;

int ans;
int h, w;
int ttm[30][30];
int c;

bool ok(int x, int y){
    return x==0 ||
        y==0 ||
        ttm[y][x]==ttm[y][x-1] ||
        ttm[y][x-1]==ttm[y-1][x-1] ||
        ttm[y-1][x-1]==ttm[y-1][x] ||
        ttm[y-1][x]==ttm[y][x];
}

void dfs(int x, int y){
    if(x==w){
    if(y==h-1){
            ans++;
            return;
        }
        else dfs(0,y+1);
        return;
    }

    if(ttm[y][x]) dfs(x+1,y);
    else{
        if(x+1!=w && ttm[y][x+1]==0){
            ttm[y][x] = ttm[y][x+1] = c++;
            if(ok(x,y)) dfs(x+2,y);
            ttm[y][x] = ttm[y][x+1] = 0;
        }
        if(y+1!=h && ttm[y+1][x]==0){
            ttm[y][x] = ttm[y+1][x] = c++;
            if(ok(x,y)) dfs(x+1,y);
            ttm[y][x] = ttm[y+1][x] = 0;
        }
    }
}
int main(){
    while(cin >> h >> w && h){
        ans = 0;
        c = 1;
        memset(ttm,0,sizeof(ttm));
        dfs(0, 0);
        cout << ans << endl;
    }
}
```