#include <iostream>
#include <iomanip>
using namespace std;

int m, n, table[20][20];

bool ifcrossed(){
    bool flg = false;
    for(int j = 0; j < m-1 && !flg; j++){
        for(int k = 0; k < n-1 && !flg; k++){
            if( table[j][k] != table[j+1][k] &&
                    table[j][k] != table[j][k+1] &&
                    table[j+1][k] != table[j+1][k+1] &&
                    table[j][k+1] != table[j+1][k+1] ){
                flg = true;
            }
        }
    }
    return flg;
}

int tatami(int d){
    int i;
    bool cross;
    for(i = 0; i < m*n; i++){
        if( table[i/n][i%n] == 0 ) break;
    }
    int ans = 0;
    if( i%n < n-1 && !table[i/n][i%n]  && !table[i/n][i%n+1] ){
        table[i/n][i%n] = d;
        table[i/n][i%n+1] = d;
        if( d == m*n/2 ){
            bool flg = ifcrossed();
            if( !flg ) ans++;
            /*
            if( !flg ){
                for(int j = 0; j < m; j++){
                    for(int k = 0; k < n; k++){
                        cout << setw(3) << table[j][k];
                    }
                    cout << '\n';
                }
                cout << '\n';
            }
            */
        }else{ 
            if( !ifcrossed() ){
                ans += tatami(d+1);
            }
        }
        table[i/n][i%n] = 0;
        table[i/n][i%n+1] = 0;
    }
    if( i/n < m-1 && table[i/n][i%n] == 0 && table[i/n+1][i%n] == 0){
        table[i/n][i%n] = d;
        table[i/n+1][i%n] = d;
        if( d == m*n/2 ){
            bool flg = ifcrossed();
            if( !flg ) ans++;
            /*
            if( !flg ){
                for(int j = 0; j < m; j++){
                    for(int k = 0; k < n; k++){
                        cout << setw(3) << table[j][k];
                    }
                    cout << '\n';
                }
                cout << '\n';
            }
            */
        }else{
            if( !ifcrossed() ){
                ans += tatami(d+1);
            }
        }
        table[i/n][i%n] = 0;
        table[i/n+1][i%n] = 0;
    }
    return ans;
}

int main(){
    cin >> m >> n;
    while(m + n > 0){
        for(int i = 0; i < m; i++){
            for(int j = 0; j < n; j++){
                table[i][j] = 0;
            }
        }
        if( m%2 && n%2 ){
            cout << 0 << endl;
        }else{
            cout << tatami(1) << endl;
        }
        cin >> m >> n;
    }
    return 0;
}
### 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 <iomanip>
using namespace std;

int m, n, table[20][20];

bool ifcrossed(){
    bool flg = false;
    for(int j = 0; j < m-1 && !flg; j++){
        for(int k = 0; k < n-1 && !flg; k++){
            if( table[j][k] != table[j+1][k] &&
                    table[j][k] != table[j][k+1] &&
                    table[j+1][k] != table[j+1][k+1] &&
                    table[j][k+1] != table[j+1][k+1] ){
                flg = true;
            }
        }
    }
    return flg;
}

int tatami(int d){
    int i;
    bool cross;
    for(i = 0; i < m*n; i++){
        if( table[i/n][i%n] == 0 ) break;
    }
    int ans = 0;
    if( i%n < n-1 && !table[i/n][i%n]  && !table[i/n][i%n+1] ){
        table[i/n][i%n] = d;
        table[i/n][i%n+1] = d;
        if( d == m*n/2 ){
            bool flg = ifcrossed();
            if( !flg ) ans++;
            /*
            if( !flg ){
                for(int j = 0; j < m; j++){
                    for(int k = 0; k < n; k++){
                        cout << setw(3) << table[j][k];
                    }
                    cout << '\n';
                }
                cout << '\n';
            }
            */
        }else{ 
            if( !ifcrossed() ){
                ans += tatami(d+1);
            }
        }
        table[i/n][i%n] = 0;
        table[i/n][i%n+1] = 0;
    }
    if( i/n < m-1 && table[i/n][i%n] == 0 && table[i/n+1][i%n] == 0){
        table[i/n][i%n] = d;
        table[i/n+1][i%n] = d;
        if( d == m*n/2 ){
            bool flg = ifcrossed();
            if( !flg ) ans++;
            /*
            if( !flg ){
                for(int j = 0; j < m; j++){
                    for(int k = 0; k < n; k++){
                        cout << setw(3) << table[j][k];
                    }
                    cout << '\n';
                }
                cout << '\n';
            }
            */
        }else{
            if( !ifcrossed() ){
                ans += tatami(d+1);
            }
        }
        table[i/n][i%n] = 0;
        table[i/n+1][i%n] = 0;
    }
    return ans;
}

int main(){
    cin >> m >> n;
    while(m + n > 0){
        for(int i = 0; i < m; i++){
            for(int j = 0; j < n; j++){
                table[i][j] = 0;
            }
        }
        if( m%2 && n%2 ){
            cout << 0 << endl;
        }else{
            cout << tatami(1) << endl;
        }
        cin >> m >> n;
    }
    return 0;
}
```