#include <bits/stdc++.h>

using namespace std;

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