#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (f = -f);
  for (x = ch ^ 48; isdigit(ch = getchar());
       x = (x << 3) + (x << 1) + (ch ^ 48))
    ;
  return x * f;
}
template <class T>
T Max(T a, T b) {
  return a > b ? a : b;
}
template <class T>
T Min(T a, T b) {
  return a < b ? a : b;
}
long long n, t, ans, f[25][5][5][25][25];
int main() {
  n = read();
  t = read();
  if (n <= 2) return puts("0"), 0;
  for (int i = 1; i <= 4; ++i)
    for (int j = 1; j <= 4; ++j)
      if (i != j) f[2][i][j][0][0] = 1;
  for (int l = 2; l <= n; ++l)
    for (int a1 = 0; a1 <= t; ++a1)
      for (int a2 = 0; a2 <= t - 1; ++a2)
        for (int i = 1; i <= 4; ++i)
          for (int j = 1; j <= 4; ++j)
            for (int k = 1; k <= 4; ++k) {
              if (i < j && j > k) {
                f[l + 1][j][k][a1 + 1][a2] += f[l][i][j][a1][a2];
                continue;
              }
              if (i > j && j < k) {
                f[l + 1][j][k][a1][a2 + 1] += f[l][i][j][a1][a2];
                continue;
              }
              if (i != j && j != k)
                f[l + 1][j][k][a1][a2] += f[l][i][j][a1][a2];
            }
  for (int i = 1; i <= 4; ++i)
    for (int j = 1; j <= 4; ++j)
      if (i != j) ans += f[n][i][j][t][t - 1];
  printf("%lld\n", ans);
  return 0;
}
