#include <bits/stdc++.h>
using namespace std;
int read() {
  int f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
inline void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
  return;
}
int n, f[20 + 5][10 + 5][5 + 5][2];
int main() {
  int n = read(), T = read();
  for (int i = 1; i <= 4; i++) f[1][1][i][1] = 1;
  for (int x = 2; x <= n; ++x)
    for (int t = 1; t <= T; ++t)
      for (int i = 1; i <= 4; ++i)
        for (int j = 1; j <= 4; ++j) {
          if (j < i)
            f[x][t][i][1] += f[x - 1][t][j][1] + f[x - 1][t - 1][j][0];
          else if (j > i && x != 2)
            f[x][t][i][0] += f[x - 1][t][j][0] + f[x - 1][t][j][1];
        }
  int sum = 0;
  for (int i = 1; i <= 4; ++i) sum += f[n][T][i][0];
  printf("%d\n", sum);
  return 0;
}
