#include <bits/stdc++.h>
using namespace std;
template <class T>
int len(const T &c) {
  return (int)c.size();
}
int n, t;
int memo[25][25][25][2];
int dp(int cpos, int ct, int hump, int sign, int p) {
  if (cpos == n) {
    return sign == 1 && hump == t;
  }
  int &ret = memo[cpos][ct][hump][sign];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = ct + 1; i < 5; i++) ret += dp(cpos + 1, i, hump, 0, 1);
  if (p)
    if (sign == 0)
      for (int i = ct - 1; i >= 1; i--) ret += dp(cpos + 1, i, hump + 1, 1, 1);
  if (sign == 1)
    for (int i = ct - 1; i >= 1; i--) ret += dp(cpos + 1, i, hump, 1, 1);
  return ret;
}
int main() {
  cin >> n >> t;
  memset(memo, -1, sizeof(memo));
  int ans = 0;
  ans += dp(1, 1, 0, 0, 0);
  ans += dp(1, 2, 0, 0, 0);
  ans += dp(1, 3, 0, 0, 0);
  cout << ans;
}
