#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, t;
  cin >> n >> t;
  vector<vector<vector<vector<vector<int> > > > > c(
      n + 1,
      vector<vector<vector<vector<int> > > >(
          4, vector<vector<vector<int> > >(
                 4, vector<vector<int> >(t + 2, vector<int>(t + 1, 0)))));
  for (int p = 0; p < 4; ++p) {
    for (int l = 0; l < 4; ++l) {
      if (l != p) c[2][p][l][0][0] = 1;
    }
  }
  for (int len = 2; len < n; ++len) {
    for (int p = 0; p < 4; ++p) {
      for (int l = 0; l < 4; ++l) {
        for (int h = 0; h <= t; ++h) {
          for (int v = 0; v < t; ++v) {
            if (c[len][p][l][h][v] == 0) continue;
            for (int nl = 0; nl < 4; ++nl) {
              if (nl != l) {
                int nh = h;
                if (p < l && l > nl) ++nh;
                int nv = v;
                if (p > l && l < nl) ++nv;
                c[len + 1][l][nl][nh][nv] += c[len][p][l][h][v];
              }
            }
          }
        }
      }
    }
  }
  int ans = 0;
  for (int p = 0; p < 4; ++p) {
    for (int l = 0; l < 4; ++l) {
      ans += c[n][p][l][t][t - 1];
    }
  }
  cout << ans << endl;
}
