#include <bits/stdc++.h>
int n, t, ans, f[21][5][5][11][11];
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= 4; i++)
    for (int j = 1; j <= 4; j++) f[2][i][j][0][0] = i != j;
  for (int i = 3; i <= n; i++)
    for (int j = 1; j <= 4; j++)
      for (int k = 1; k <= 4; k++)
        for (int x = 0; x <= t; x++)
          for (int y = 0; y <= t; y++)
            for (int l = 1; l <= 4; l++)
              if (k != l)
                f[i][k][l][x + (j < k && k > l)][y + (j > k && k < l)] +=
                    f[i - 1][j][k][x][y];
  for (int i = 1; i <= 4; i++)
    for (int j = 1; j <= 4; j++) ans += f[n][i][j][t][t - 1];
  printf("%d\n", ans);
}
