#include <bits/stdc++.h>
using namespace std;
int n, t;
long long dp[22][5][5][11][11];
template <typename T>
inline void read(T &x) {
  x = 0;
  char ch = getchar();
  int f = 1;
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  x *= f;
}
int main() {
  read(n);
  read(t);
  if (n <= 2) return printf("0\n"), 0;
  for (int i = 1; i <= 4; i++)
    for (int j = 1; j <= 4; j++)
      if (i != j) dp[2][i][j][0][0] = 1;
  for (int pos = 2; pos <= n; pos++)
    for (int k1 = 0; k1 <= t; k1++)
      for (int k2 = 0; k2 <= t - 1; k2++)
        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)
                dp[pos + 1][j][k][k1 + 1][k2] += dp[pos][i][j][k1][k2];
              else if (i > j && j < k)
                dp[pos + 1][j][k][k1][k2 + 1] += dp[pos][i][j][k1][k2];
              else if (i != j && j != k)
                dp[pos + 1][j][k][k1][k2] += dp[pos][i][j][k1][k2];
  long long ans = 0;
  for (int i = 1; i <= 4; i++)
    for (int j = 1; j <= 4; j++) ans += dp[n][i][j][t][t - 1];
  printf("%lld\n", ans);
  return 0;
}
