#include <bits/stdc++.h>
using namespace std;

long long int n, m;

int main()
{
   cin >> n >> m;

   if(n != 1 and m != 1)
      cout << 2 * n + 2 * m - 4 + ((n - 2) * (m - 2)) / 2 << endl;
   else if(n == 1 and m != 1)
      cout << m << endl;
   else if(m == 1 and n != 1)
      cout << n << endl;
   else
      cout << 1 << endl;

   return 0;
}