#include <bits/stdc++.h>

using namespace std;

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