#include <bits/stdc++.h>
using namespace std;
  int n,m;
  unsigned long long sum=0;
int main(){
  cin >> n >> m;
  sum=(n*2)+((m-2)*2);
  sum+=(m-2)*(n-2)/2;
  if(n==1){
    cout << m << endl;
  }
  else if(m==1){
    cout << n << endl;
  }
  else{
    cout << sum << endl;
  }
  return 0;
}