#include <iostream>

using namespace std;

int main()
{
    int n,m;
    unsigned long long res=0;
    cin>>n>>m;
    if(n==1)
        res=m;
    else if(m==1)
        res=n;
    else
        res=2*n+2*(m-2)+(m-2)*(n-2)/2;
    cout<<res;
}