#include <iostream>

using namespace std;

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