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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    unsigned long long n, m;
    cin >> n >> m;
    unsigned long long amt;
    if (n>2 && m>2)
        amt = n*m-(n-2)*(m-2) + (n-2)*(m-2)/2;
    else
        amt = n*m;
    cout << amt;
    return 0;
}