#include <bits/stdc++.h>
using namespace std;
int n, t;
int dp[50][5][5][20][20];
int f(int x, int p, int q, int a, int b) {
  if (a > t || b > t - 1) return 0;
  if (x == n) return a == t && b == t - 1;
  if (dp[x][p][q][a][b] != -1) return dp[x][p][q][a][b];
  int &ret = dp[x][p][q][a][b] = 0;
  for (int(i) = (1), _n = (4); (i) <= _n; (i)++) {
    if (q == i) continue;
    int ta = a, tb = b;
    ta += p != 0 && q != 0 && p < q && q > i;
    tb += p != 0 && q != 0 && p > q && q < i;
    ret += f(x + 1, q, i, ta, tb);
  }
  return ret;
}
int main() {
  scanf("%d %d", &n, &t);
  memset(dp, -1, sizeof(dp));
  int ans = 0;
  printf("%d\n", f(0, 0, 0, 0, 0));
  return 0;
}
