#include <bits/stdc++.h>
using namespace std;
int dp[30][15][15][6][6];
int main() {
  int n, t;
  int i, j, k, x, y, z;
  memset(dp, 0, sizeof(dp));
  scanf("%d %d", &n, &t);
  for (i = 1; i <= 4; i++) {
    for (j = 1; j <= 4; j++) {
      if (i != j) dp[2][0][0][i][j] = 1;
    }
  }
  for (i = 2; i < n; i++) {
    for (j = 0; j <= t; j++) {
      for (k = 0; k <= t - 1; k++) {
        for (x = 1; x <= 4; x++) {
          for (y = 1; y <= 4; y++) {
            for (z = 1; z <= 4; z++) {
              if (x == y || y == z) continue;
              if (y > x && y > z) {
                dp[i + 1][j + 1][k][y][z] += dp[i][j][k][x][y];
              } else if (y < x && y < z) {
                dp[i + 1][j][k + 1][y][z] += dp[i][j][k][x][y];
              } else {
                dp[i + 1][j][k][y][z] += dp[i][j][k][x][y];
              }
            }
          }
        }
      }
    }
  }
  int sum = 0;
  for (i = 1; i <= 4; i++) {
    for (j = 1; j <= 4; j++) {
      sum += dp[n][t][t - 1][i][j];
    }
  }
  printf("%d\n", sum);
  return 0;
}
