#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

int H, W;

bool inside(int i, int j){
     return 0 <= i && i < H && 0 <= j && j < W;
}

bool exist(vector<vector<int>>& field, int i, int j){
    return !inside(i, j) || field[i][j] != 0;
}

bool different(vector<vector<int>>& field, int ai, int aj, int bi, int bj){
    return inside(ai, aj) && inside(bi, bj) && field[ai][aj] != 0 && field[bi][bj] != 0 && field[ai][aj] != field[bi][bj];
}

bool able(vector<vector<int>>& field, int i, int j){
    return !(different(field, i-1, j-1, i-1, j) && different(field, i, j-1, i-1, j-1)) && !(different(field, i+1, j-1, i+1, j) && different(field, i+1, j-1, i, j-1));
}

int dfs(vector<vector<int>>& field, int idx){
    vector<vector<int>> next = field;

    while(true){
        bool change = false;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(next[i][j] == 0){
                    if((exist(next, i-1, j) && exist(next, i, j-1) && exist(next, i+1, j))
                        || (j + 1 < W && next[i][j+1] == 0 && (different(next, i-1, j, i-1, j+1) || different(next, i-1, j, i-1, j+1)))){
                        if(j + 1 < W && next[i][j+1] == 0 && able(next, i, j) && able(next, i, j+1)){
                            next[i][j] = idx;
                            next[i][j+1] = idx;
                            idx++;
                            change = true;
                            break;
                        }else{
                            return 0;
                        }
                    }
                    if((exist(next, i-1, j) && exist(next, i, j-1) && exist(next, i, j+1))
                        || (i + 1 < H && next[i+1][j] == 0 && (different(next, i, j-1, i+1, j-1) || different(next, i, j+1, i+1, j+1)))){
                        if(i + 1 < H && next[i+1][j] == 0 && able(next, i, j) && able(next, i+1, j)){
                            next[i][j] = idx;
                            next[i+1][j] = idx;
                            idx++;
                            change = true;
                            break;
                        }else{
                            return 0;
                        }
                    }
                }
            }
            if(change) break;
        }
        if(!change) break;
    }

    if(idx == H * W / 2 + 1){
        return 1;
    }

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(next[i][j] == 0){
                assert(i + 1 < H && next[i+1][j] == 0);
                assert(j + 1 < W && next[i][j+1] == 0);
                int ret = 0;
                next[i][j] = idx;
                next[i+1][j] = idx;
                if(able(next, i, j) && able(next, i+1, j)) ret += dfs(next, idx+1);
                next[i+1][j] = 0;
                next[i][j+1] = idx;
                if(able(next, i, j) && able(next, i, j+1)) ret += dfs(next, idx+1);
                return ret;
            }
        }
    }
    assert(false);
    return 0;
}

int main(){
    while(true){
        cin >> H >> W;
        if(H == 0) break;
        vector<vector<int>> field(H, vector<int>(W, 0));
        cout << dfs(field, 1) << endl;
    }

    return 0;
}

Measured memory_bytes: 3080