#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;
}

### Prompt

Please provide a CPP coded solution to the problem described below:

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 <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;
}

```