#include <iostream>

using namespace std;

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    unsigned long long int n, m, r=0;
    cin>>n>>m;
    r+=2*m;
    r+=2* (n-2);
    m-=2;
    n-=2;
    r+=(n*m)/2;
    cout<<r;


    return 0;
}