#include<bits/stdc++.h>
using namespace std;;
int main()
{
    long long a,b;
    cin>>a>>b;// unesite dimenzije matrice;
    long long br;
    br=((2*a)+(2*b)-4)+(((a-2)*(b-2))/2);
    cout<<br;

    return 0;
}