// OBčh2009 Day2 I : Tatami #include #include using namespace std; int ans, w, h; int a[20][20]; void search(int pos){ for(int i=pos;i<=w*h;i++){ if(i==w*h) { ans++; return; } int x = i%w, y = i/w; if(a[x][y]!=-1) continue; if(x!=0&&y!=0&&a[x-1][y]!=a[x-1][y-1]&&a[x-1][y-1]!=a[x][y-1]) return; a[x][y] = i; if(y!=h-1&&a[x][y+1]==-1){ a[x][y+1] = i; search(pos+1); a[x][y+1] = -1; } if(x!=w-1&&a[x+1][y]==-1){ a[x+1][y] = i; search(pos+2); a[x+1][y] = -1; } a[x][y] = -1; break; } } int main(){ while(cin >> w >> h, w){ memset(a, -1, sizeof(a)); ans = 0; search(0); cout << ans << endl; } return 0; }