#include<bits/stdc++.h>

using namespace std;

typedef unsigned long long int ull;

int main(){

    ull N = 0, M = 0, brojac = 1, resenje = 0;

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> N >> M;

    resenje = floor(((N-2)*(M-2))/2) + 2*(N - 2 + M);

    cout << resenje << '\n';


}