//* Problem  : D - Mondriaan's Dream
//* Contest  : acm.tju.edu.cn
//* Origin   : University of Ulm Local Contest 2000
//* Type     : Solution
//* Date     : 2008.06.07
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 8.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <iostream>
using namespace std;
#define int64 long long
#define INF 1000000000
#define EPS 1E-8

#define ALL(a) a.begin(), a.end()
#define PB(a, v) a.push_back(v)
#define MP(a,b) make_pair(a, b)
#define FOR(i, n) for (int i = 0; i < (int)(n); i++)
#define FORO(i, obj) for (int i = 0; i < (int)(obj.size); i++)

int n, m;

int64 dp[32][1<<12], res;

void calc(int x, int y, int mask, int next)
{
	if (x == n)	return;
	if (y >= m)
		dp[x+1][next] += dp[x][mask];
	else
	{
		int my = 1 << y;
		if (mask & my)
			calc(x, y + 1, mask, next);
		else
		{
			calc(x, y + 1, mask, next | my);
			if (y + 1 < m && !(mask & my) && !(mask & (my << 1)))
				calc(x, y + 2, mask, next);
		}
	}

}

int main()
{
#ifdef _DEBUG
	freopen("1166.in", "r", stdin);
#endif
	while (scanf("%d%d", &n, &m) == 2 && n)
	{
		memset(dp, 0, sizeof(dp));
		dp[0][0] = 1;
		for (int x = 0; x < n; x++)
			for (int mask = 0; mask < (1<<m); mask++)
				calc(x, 0, mask, 0);
		res = dp[n][0];
		printf("%lld\n", res);
	}
	return 0;
}
