#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define li long long int
using namespace std;
long long n,m,T;
int main(){
   cin >> n >> m;
   if (n==1 and m==1) cout << 1 << "\n";
   else {
      if (n==1 or m==1) cout << n*m << "\n";
      else cout << 2*n+2*m-4+((n-2)*(m-2))/2 << "\n";
   }
   return 0;
}