#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N,M;
    cin>>N>>M;

    int s=2*(N+M)-4;

    int Nu=N-2;
    int Mu=M-2;
    
    int u=(Nu*Mu)/2;
    int r=s+u;
    cout<<r;

}