题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1100
/*
题意:一个n*m的方格,要求用1*2的砖把它铺满,问有多少种铺法。
思路:dp[i][j]表示第i行在状态j下所有合法的铺法总数。第i行的状态可以由第i-1行推得,且易知
第i-1行的空缺只能由第i行对应位置用竖着的砖来补上。
*/
#include<cstring>
#include<string>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<set>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int N=12;
ll dp[N][1<<N];
ll n,m;
ll judge(ll x)
{
for(ll i=0;i<m;)
{
if(x&(1<<i))
{
if(i==m-1) return 0;
if((x&(1<<(i+1)))==0) return 0;
i+=2;
}
else ++i;
}
return 1;
}
ll solve(ll pre,ll s)
{
if(s==(n+1)) return (pre==((1<<m)-1))?1:0;
if(dp[s][pre]!=-1) return dp[s][pre];
dp[s][pre]=0;
ll ned=((1<<m)-1)^pre;
for(ll i=0;i<(1<<m);++i)
{
if((i&ned)!=ned) continue;
if(judge(i^ned))
dp[s][pre]+=solve(i,s+1);
}
return dp[s][pre];
}
int main()
{
while(~scanf("%lld %lld",&n,&m),n&&m)
{
if((n*m)%2)
{
printf("0\n");
continue;
}
if(m>n) swap(n,m);
memset(dp,-1,sizeof(dp));
printf("%lld\n",solve((1<<m)-1,1));
}
return 0;
}