program nice_patterns;

var
  r, i, j, k, m, n, p: longint;
  a: array [0..30, 0..127] of longint;

function ok(x, y: longint): boolean;
var
  a, b: array [1..10] of integer;
  i: integer;
begin
  ok := false;
  for i := 1 to m do
  begin
    a[i] := x and 1;
    b[i] := y and 1;
    x := x shr 1;
    y := y shr 1;
    if (i > 1) and
      ((a[i] = a[i-1]) and (a[i] = b[i]) and (a[i] = b[i-1])) then exit;
  end;
  ok := true;
end;

begin
{  assign(input, 'input.txt');
  reset(input);
  assign(output, 'output.txt');
  rewrite(output);}

  read(m, n);
  if m > n then
  begin
    i := m; m := n; n := i;
  end;

  p := 1;
  for i := 1 to m do
    p := p shl 1;
  p := p - 1;

  fillchar(a, sizeof(a), 0);
  for i := 0 to p do
    a[1][i] := 1;

  for i := 2 to n do
  begin
    for j := 0 to p do
      for k := 0 to p do
      begin
        if ok(j, k) then
          a[i][k] := a[i-1][j] + a[i][k];
      end;
  end;

  r := 0;
  for i := 0 to p do
    r := r + a[n][i];

  writeln(r);

  close(input);
  close(output);
end.
