#include <iostream>

using namespace std;
long long finale(long long n,long long m)
{
return 2*m+2*n-4+(n-2)*(m-2)/2;
}
int main()
{
    long long n,m;
    cin>>n>>m;
    cout<<finale(n,m);
    return 0;
}