// 1
// 2
// 3
// 4

#include <cstdio>
#include <cassert>
#include <cstring>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>

using namespace std;

// Í.Î.Ï.

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long hash_t;
typedef long double ll;

const int N = 20;

int w, h, u[N][N];
map <hash_t, ll> mem;

// O(2^w * wh * log)
ll go( int x, int y )
{
  if (x == w)
    x = 0, y++;
  if (y == h)
    return 1;
  if (u[y][x])
    return go(x + 1, y);

  hash_t hash = 0;
  #define ADD(x) hash = hash * 239 + (x)
  ADD(x);
  ADD(y);
  forn(i, h)
    forn(j, w)
      ADD(u[i][j]);
  if (mem.count(hash))
    return mem[hash];

  ll &sum = mem[hash];

  /**
  
  111111
  111111
  1
   11011
  1
   00000
  000000
  000000

  wh * 2^w 
  w, h = 10, ~10^5

  */

  if (x + 1 < w && !u[y][x + 1])
  {
    u[y][x] = u[y][x + 1] = 1;
    sum += go(x + 1, y);
    u[y][x] = u[y][x + 1] = 0;
  }
  if (y + 1 < h && !u[y + 1][x])
  {
    u[y][x] = u[y + 1][x] = 1;
    sum += go(x + 1, y);
    u[y][x] = u[y + 1][x] = 0;
  }
  return sum;
}

int main()
{
  assert(scanf("%d%d", &w, &h) == 2);
  assert(w <= N && h <= N);

  cout << go(0, 0) << endl;
  printf("%d\n", mem.size());
  return 0;
}