#include <bits/stdc++.h>
using namespace std;
const int inf = 1e6;
int t, n, m, k, dp[21][5][2][11][11];
string s;
int solve(int i, int h, int prevBig, int topleft, int bottomleft) {
  if (h > 4 || h < 1) return 0;
  if (i == n) {
    if (topleft == 0 && bottomleft == 0) return 1;
    return 0;
  }
  int &ans = dp[i][h][prevBig][topleft][bottomleft];
  if (ans != -1) return ans;
  ans = 0;
  if (prevBig == -1) {
    for (int j = 1; j <= 3; j++)
      ans += solve(i + 1, h + j, 0, topleft, bottomleft);
    for (int j = 1; j <= 3; j++)
      ans += solve(i + 1, h - j, 1, topleft, bottomleft);
  }
  if (prevBig) {
    for (int j = 1; j <= 3; j++)
      ans += solve(i + 1, h + j, 0, topleft, bottomleft - 1);
    for (int j = 1; j <= 3; j++)
      ans += solve(i + 1, h - j, 1, topleft, bottomleft);
  } else {
    for (int j = 1; j <= 3; j++)
      ans += solve(i + 1, h + j, 0, topleft, bottomleft);
    for (int j = 1; j <= 3; j++)
      ans += solve(i + 1, h - j, 1, topleft - 1, bottomleft);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> t;
  int ans = 0;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= 4; i++) ans += solve(1, i, -1, t, t - 1);
  cout << ans;
  return 0;
}
