#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    unsigned long long N, M;
    cin >> N >> M;
    unsigned long long brojRedara;

    brojRedara = 2*N + 2*M - 4;
    brojRedara += ((N-2)*(M-2))/2;

    cout << brojRedara;
    return 0;
}