#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t;
  cin >> n >> t;
  long long dp[n + 3][2 * t + 3][5];
  for (int i = 1; i <= 4; i++) {
    dp[n][2 * t - 1][i] = 1;
    for (int j = 0; j < 2 * t - 1; j++) {
      dp[n][j][i] = 0;
    }
    for (int j = 1; j <= n; j++) {
      dp[j][2 * t][i] = 0;
    }
  }
  for (int i = n - 1; i >= 1; i--) {
    for (int j = 2 * t - 1; j >= 0; j--) {
      for (int k = 1; k <= 4; k++) {
        dp[i][j][k] = 0;
        if (j % 2 == 0) {
          for (int p = 1; p < k; p++) {
            dp[i][j][k] = dp[i][j][k] + dp[i + 1][j + 1][p];
          }
          for (int p = k + 1; p <= 4; p++) {
            dp[i][j][k] = dp[i][j][k] + dp[i + 1][j][p];
          }
        } else {
          for (int p = 1; p < k; p++) {
            dp[i][j][k] = dp[i][j][k] + dp[i + 1][j][p];
          }
          for (int p = k + 1; p <= 4; p++) {
            dp[i][j][k] = dp[i][j][k] + dp[i + 1][j + 1][p];
          }
        }
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= 4; i++) {
    ans = ans + (i - 1) * dp[2][0][i];
  }
  cout << ans;
  return 0;
}
