#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, h = 5, dp[30][30][5];
  cin >> n >> t;
  t = 2 * t - 1;
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i < 5; i++) dp[n - 1][t][i] = 1;
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j <= t; j++) {
      for (int k = 1; k < h; k++) {
        if (j % 2) {
          for (int c = k - 1; c >= 1; c--) {
            dp[i][j][k] += dp[i + 1][j][c];
          }
          for (int c = k + 1; c < h; c++) {
            dp[i][j][k] += dp[i + 1][j + 1][c];
          }
        } else {
          for (int c = k + 1; c < h; c++) {
            dp[i][j][k] += dp[i + 1][j][c];
          }
          for (int c = k - 1; c >= 1; c--) {
            dp[i][j][k] += dp[i + 1][j + 1][c];
          }
        }
      }
    }
  }
  int r = 0;
  for (int i = 1; i < h; i++) {
    r += (i - 1) * dp[1][0][i];
  }
  cout << r << endl;
}
