#include <iostream>
using namespace std;
int main()
{
    unsigned long long n, m;
    cin >> n >> m;
    if(n == 1 || m == 1)
    {
        cout << max(n, m);
    }
    else
    {
        unsigned long long zbir = 2*n + 2*(m-2);
        zbir += (n-2)*(m-2)/2;
        cout << zbir;
    }
    return 0;
}