#include <bits/stdc++.h>
using namespace std;
long long dp[25][15][15][7][4], n, t;
int main() {
  cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
  cin >> n >> t;
  dp[2][0][0][1][0] = 3;
  dp[2][0][0][1][1] = 0;
  dp[2][0][0][2][0] = 2;
  dp[2][0][0][2][1] = 1;
  dp[2][0][0][3][0] = 1;
  dp[2][0][0][3][1] = 2;
  dp[2][0][0][4][0] = 0;
  dp[2][0][0][4][1] = 3;
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= t; j++) {
      for (int k = 0; k <= t - 1; k++) {
        for (int l = 1; l <= 4; l++) {
          for (int o = 0; o <= 1; o++) {
            if (o == 0) {
              for (int it = 1; it <= 4; it++) {
                if (it > l) {
                  dp[i + 1][j][k + 1][it][1] += dp[i][j][k][l][o];
                } else if (it < l) {
                  dp[i + 1][j][k][it][0] += dp[i][j][k][l][o];
                }
              }
            } else if (o == 1) {
              for (int it = 1; it <= 4; it++) {
                if (it > l) {
                  dp[i + 1][j][k][it][1] += dp[i][j][k][l][o];
                } else if (it < l) {
                  dp[i + 1][j + 1][k][it][0] += dp[i][j][k][l][o];
                }
              }
            }
          }
        }
      }
    }
  }
  long long count1 = 0;
  for (int i = 1; i <= 4; i++) {
    for (int j = 0; j <= 1; j++) {
      count1 += dp[n][t][t - 1][i][j];
    }
  }
  cout << count1;
}
