#include <bits/stdc++.h>
int main() {
  int dp[21][5][2][11] = {0};
  dp[2][2][0][0] = 1;
  dp[2][3][0][0] = 2;
  dp[2][4][0][0] = 3;
  for (int i = 3; i < 21; i++) {
    for (int j = 1; j <= 4; j++) {
      for (int k = 1; k < j; k++) {
        for (int o = 0; o <= 10; o++) {
          dp[i][j][0][o] += dp[i - 1][k][1][o];
          dp[i][j][0][o] += dp[i - 1][k][0][o];
        }
      }
      for (int k = 4; k > j; k--) {
        for (int o = 0; o <= 10; o++) {
          dp[i][j][1][o + 1] += dp[i - 1][k][0][o];
          dp[i][j][1][o] += dp[i - 1][k][1][o];
        }
      }
    }
  }
  int n, t;
  while (scanf("%d%d", &n, &t) != EOF) {
    int ans = 0;
    for (int i = 1; i <= 4; i++) {
      ans += dp[n][i][1][t];
    }
    printf("%d\n", ans);
  }
}
