#include <bits/stdc++.h>
using namespace std;
int n,m;
long long sum;
void ivice(){
    sum+=(2*n+2*(m-2));
}
void sredina(){
    sum+=floor((n-2)*(m-2)/2);
}
int main(){
    cin >> n >> m;
    ivice();
    sredina();
    cout << sum << endl;
    return 0;
}