def init(h, dict, i, a)
  return if i > h
  if i == h
    dict[a * ""] = 1
    return
  end

  a << ?H
  init(h, dict, i + 1, a)
  a.pop

  a << ?V
  a << ?v
  init(h, dict, i + 2, a)
  a.pop
  a.pop
end

def search(h, state, dict, i, a)
  return if i > h
  if i == h
    dict[a * ""] = 1
    return
  end

  if state[i] == ?H
    a << ?L
    search(h, state, dict, i + 1, a)
    a.pop
    return
  end

  if state[i] == ?L
    if i == h - 1 || state[i + 1] == ?H
      a << ?H
      search(h, state, dict, i + 1, a)
      a.pop
    elsif i == h - 2 || state[i + 1] == ?V || state[i + 2] == ?H
      a << ?V
      a << ?v
      search(h, state, dict, i + 2, a)
      a.pop
      a.pop
    end
    return
  end

  if state[i] == ?V
    a << ?H
    search(h, state, dict, i + 1, a)
    a.pop
    if i == h - 2 || state[i + 2] == ?H
      a << ?V
      a << ?v
      search(h, state, dict, i + 2, a)
      a.pop
      a.pop
    end
    return
  end

  # state[i] == ?v
  if i == h - 1 || state[i + 1] == ?H
    a << ?H
    search(h, state, dict, i + 1, a)
    a.pop
  elsif i == h - 2 || state[i + 1] == ?V || state[i + 2] == ?H
    a << ?V
    a << ?v
    search(h, state, dict, i + 2, a)
    a.pop
    a.pop
  end
end

loop do
  h, w = gets.split.map(&:to_i)
  break if h == 0
  h, w = w, h if w < h
  dict = {}
  init(h, dict, 0, [])

  trans = {}
  (w - 1).times do
    new_dict = Hash.new(0)
    dict.each do |state, n|
      if trans[state]
        trans[state].each do |next_state, k|
          new_dict[next_state] += n * k
        end
        next
      end
      t = {}
      search(h, state, t, 0, [])
      trans[state] = t
      trans[state].each do |next_state, k|
        new_dict[next_state] += n * k
      end
    end
    dict = new_dict
  end

  p dict.keys.reject {|s| s.include?(?H)}.map {|s| dict[s]}.inject(:+) || 0
end
