#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int okvir = 2*(n+m)-4;
    int ostatak = ((n-2)*(m-2))/2;
    int rez = okvir + ostatak;
    cout<<rez<<endl;
    return 0;
}