#include <stdio.h>
#include <string.h>
const int N = 1 << 11;
long long x[N], y[N];
int n, m, t;
bool check(int x) {
while (x) {
if (x & 1) {
x >>= 1;
if (x & 1)x >>= 1;
else return 0;
} else x >>= 1;
}
return 1;
}
bool judge(int now, int last) {
int tmp = t & (~last);
if ((now & tmp) == tmp && check(now - tmp))return 1;
return 0;
}
int main() {
while (scanf("%d%d", &n, &m), n || m) {
if ((n & 1) && (m & 1)) {
puts("0");
continue;
}
if (n < m)n ^= m, m ^= n, n ^= m;
int s = 1 << m;
t = s - 1;
for (int i = 0; i < s; i++)y[i] = check(i);
for (int i = 1; i < n; i++) {
for (int j = 0; j < s; j++)
for (int k = 0; k < s; k++)
if (judge(j, k))x[j] += y[k];
memcpy(y, x, sizeof (x[0]) * s);
memset(x, 0, sizeof (x[0]) * s);
}
printf("%lld\n",y[t]);
}
return 0;
}