#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <sstream>
 
using namespace std;
int main() 
{
   int n,m;
   cin >> n >> m;
   if (m == 1)
   {
      cout << n;
   }
   else if(n==1){
      cout << m;
   }
   else{
      cout << 2*m + 2*(n-2) + (m-2)*(n-2)/2;
   }
}