#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1677721600")
using namespace std;
int n, t;
long long foundu[25][5][20];
long long foundd[25][5][20];
long long src(int x, int y, int ups, bool up) {
  if (up == 0) {
    if (foundd[x][y][ups] != -1) return foundd[x][y][ups];
    foundd[x][y][ups] = 0;
    if (x == n) {
      foundd[x][y][ups] = 0;
      if (ups == t) foundd[x][y][ups] = 1;
      return foundd[x][y][ups];
    }
    for (int i = y + 1; i <= 4; i++) {
      foundd[x][y][ups] += src(x + 1, i, ups, 1);
    }
    for (int i = y - 1; i >= 1; i--) {
      foundd[x][y][ups] += src(x + 1, i, ups, 0);
    }
    return foundd[x][y][ups];
  }
  if (foundu[x][y][ups] != -1) return foundu[x][y][ups];
  foundu[x][y][ups] = 0;
  if (x == n) {
    foundu[x][y][ups] = 0;
    return foundu[x][y][ups];
  }
  if (ups >= t) {
    foundu[x][y][ups] = 0;
    return foundu[x][y][ups];
  }
  for (int i = y + 1; i <= 4; i++) {
    foundu[x][y][ups] += src(x + 1, i, ups, 1);
  }
  for (int i = y - 1; i >= 1; i--) {
    foundu[x][y][ups] += src(x + 1, i, ups + 1, 0);
  }
  return foundu[x][y][ups];
}
int main() {
  for (int i = 0; i < (int)25; i++)
    for (int j = 0; j < (int)5; j++)
      for (int k = 0; k < (int)20; k++) foundu[i][j][k] = -1;
  for (int i = 0; i < (int)25; i++)
    for (int j = 0; j < (int)5; j++)
      for (int k = 0; k < (int)20; k++) foundd[i][j][k] = -1;
  cin >> n >> t;
  long long answer = 0;
  for (int i = 2; i <= 4; i++) answer += (i - 1) * src(2, i, 0, 1);
  cout << answer;
  return 0;
}
