#include <bits/stdc++.h>
using namespace std;
int n, t, dp[25][6][6][12][12];
int f(int x, int ly, int my, int ts, int tz) {
  if (x == n) {
    if (ts == t && tz == t - 1) return 1;
    return 0;
  }
  if (ts > t) return 0;
  if (tz > t - 1) return 0;
  if (dp[x][ly][my][ts][tz] != -1) return dp[x][ly][my][ts][tz];
  int num = 0;
  for (int i = 1; i <= 4; i++) {
    if (i == ly) continue;
    if (my > ly && ly < i && my != 0)
      num += f(x + 1, i, ly, ts, tz + 1);
    else if (my < ly && ly > i && my != 0)
      num += f(x + 1, i, ly, ts + 1, tz);
    else
      num += f(x + 1, i, ly, ts, tz);
  }
  return dp[x][ly][my][ts][tz] = num;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(dp, -1, sizeof dp);
  cin >> n >> t;
  cout << f(0, 0, 0, 0, 0);
}
