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

int solve_any(int w, vector<int> a){
    vector<int> dp(w+1, 0);
    dp[0] = 1;
    for(int i=0; i<w; i++){
        for(int e: a){
            if(i+e > w) continue;
            dp[i+e] += dp[i];
        }
    }
    return dp[w];
}
int solve_alter(int w, vector<vector<int>> a){
    vector<vector<int>> dp(2, vector<int>(w+1,0));
    for(int d=0; d<2; d++){
        for(int e: a[d]){
            if(e > w) continue;
            dp[d][e] = 1;
        }
    }
    for(int i=0; i<w; i++){
        for(int d=0; d<2; d++){
            for(int e: a[d]){
                if(i+e > w) continue;
                dp[d][i+e] += dp[1-d][i];
            }
        }
    }
    return dp[0][w] + dp[1][w];
}

int main(){
    while(1){
        int h,w;
        cin >> h >> w;
        if(h == 0) break;

        if(h > w) swap(h, w);
        if(h == 1){
            cout << 1 - w%2 << endl;
        }else if(h == 2){
            vector<int> a(w);
            for(int i=0; i<w; i++) a[i]=i+1;
            cout << solve_alter(w, {a, {2}}) << endl;
        }else if(h%2 == 0){
            cout << solve_alter(w, {{1}, {h-2, h}}) << endl;
        }else{
            cout << 2*solve_any(w, {h-1, h+1}) << endl;
        }
    }
    return 0;
}
