#include <iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,m;
    cin >> n >> m;
    int br = (m-2)*2 + n*2;
    
    if(m%2 == 0)
        br += ((m-2)*(n-2))/2;
    else 
        br += ((m-2)*(n-2))/2;
    cout << br << "\n";
    return 0;
}