#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 28;
const double INF = 1e12, EPS = 1e-9;
int dp[20][11][10][4][4];
void run() {
  int n, t;
  cin >> n >> t;
  for (int i = 0; i < n; i++)
    for (int u = 0; u < 11; u++)
      for (int d = 0; d < 10; d++)
        for (int j = 0; j < 4; j++)
          for (int k = 0; k < 4; k++) dp[i][u][d][j][k] = 0;
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      if (i != j) dp[1][0][0][i][j] = 1;
  for (int i = 2; i < n; i++)
    for (int j = 0; j < 4; j++)
      for (int k = 0; k < 4; k++)
        for (int l = 0; l < 4; l++)
          if (k != l)
            for (int u = 0; u < i / 2 + 2; u++)
              for (int d = 0; d < i / 2 + 2; d++) {
                dp[i][u + (j < k && k > l)][d + (j > k && k < l)][k][l] +=
                    dp[i - 1][u][d][j][k];
              }
  int ans = 0;
  for (int j = 0; j < 4; j++)
    for (int k = 0; k < 4; k++) ans += dp[n - 1][t][t - 1][j][k];
  cout << ans << endl;
}
int main() { run(); }
