#include<bits/stdc++.h>
using namespace std;

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

}