#include <bits/stdc++.h>
using namespace std;

int main(){

    int n, m;
    cin>>n>>m;
    long long res;
    long long border;
    long long inside;

    border = 2*m + 2*n - 4;
    if(n%2 == 0 ^ m%2 == 0){
        inside = (m-2)*(n-2)/2;
    }
    else{
        inside = ((m-2)*(n-2)-1)/2;
    }

    res = border + inside;
    cout<<res<<endl;
}