#include <bits/stdc++.h>
using namespace std;
long long f[25][5][5][25][25], n, t, ans;
int main() {
  scanf("%lld%lld", &n, &t);
  for (int i = 1; i <= 4; i++)
    for (int j = 1; j <= 4; j++)
      if (i != j) f[2][i][j][0][0] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= t; j++) {
      for (int k = 0; k <= t - 1; k++) {
        for (int a = 1; a <= 4; a++)
          for (int b = 1; b <= 4; b++)
            for (int c = 1; c <= 4; c++) {
              if (a < b && b > c) f[i + 1][c][b][j + 1][k] += f[i][b][a][j][k];
              if (a < b && b < c) f[i + 1][c][b][j][k] += f[i][b][a][j][k];
              if (a > b && b > c) f[i + 1][c][b][j][k] += f[i][b][a][j][k];
              if (a > b && b < c) f[i + 1][c][b][j][k + 1] += f[i][b][a][j][k];
            }
      }
    }
  }
  for (int i = 1; i <= 4; i++)
    for (int j = 1; j <= 4; j++)
      if (i != j) ans += f[n][i][j][t][t - 1];
  printf("%lld", ans);
}
