#include <bits/stdc++.h>
using namespace std;
long long dp[22][12][12][5][5];
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 1; i <= 4; i++) {
    for (int j = 1; j <= 4; j++) {
      if (i == j) continue;
      dp[2][0][0][i][j] = 1;
    }
  }
  for (int len = 3; len <= n; len++) {
    for (int i = 0; i <= t; i++) {
      for (int j = 0; j <= t - 1; j++) {
        for (int k = 1; k <= 4; k++) {
          for (int l = 1; l <= 4; l++) {
            if (k == l) continue;
            for (int now = 1; now <= 4; now++) {
              if (now == l) continue;
              if (l > now && l > k)
                dp[len][i + 1][j][l][now] += dp[len - 1][i][j][k][l];
              else if (l < now && l < k)
                dp[len][i][j + 1][l][now] += dp[len - 1][i][j][k][l];
              else
                dp[len][i][j][l][now] += dp[len - 1][i][j][k][l];
            }
          }
        }
      }
    }
  }
  long long res = 0;
  for (int i = 1; i <= 4; i++)
    for (int j = 1; j <= 4; j++) res += dp[n][t][t - 1][i][j];
  cout << res << endl;
  return 0;
}
