#include <bits/stdc++.h>
using namespace std;
int a[25][15][5];
int b[25][15][5];
int n, m;
int main() {
  int i, j, k, l;
  cin >> m >> n;
  a[1][0][1] = a[1][0][2] = a[1][0][3] = a[1][0][4] = 1;
  for (i = 1; i <= 4; i++) {
    for (j = 1; j < i; j++) {
      a[2][0][i] += a[1][0][j];
    }
  }
  for (i = 3; i <= m; i++) {
    for (j = 0; j <= n; j++) {
      for (k = 1; k <= 4; k++) {
        for (l = 1; l < k; l++) {
          a[i][j][k] += (a[i - 1][j][l] + b[i - 1][j][l]);
        }
        if (j) {
          for (l = 4; l > k; l--) {
            b[i][j][k] += b[i - 1][j][l] + a[i - 1][j - 1][l];
          }
        }
      }
    }
  }
  int re = 0;
  for (i = 1; i <= 4; i++) {
    re += b[m][n][i];
  }
  cout << re << endl;
  return 0;
}
