#include <stdio.h>
#include <stdlib.h>

int **matAlloc(int n, int m){
  int **mat = (int**)malloc(n*sizeof(int*));
  for(int i = 0; i < n; i++){
    mat[i] = (int*)malloc(m*sizeof(int));
  }
  return mat;
}

int sum(int **mat, int n, int m){
  int sum = 0;
    for(int i = 0; i < n; i++){
      for(int j = 0; j < m ; j++){
        if(i == j || i + j == n - 1)
          continue;
        sum++;
      }
    }
  return sum + 4;
}

int main(){
  int n, m;
  int **mat;
  scanf("%d %d", &n, &m);
  mat = matAlloc(n, m);
  int suma = sum(mat, n, m);
  printf("%d", suma);
}