#include <bits/stdc++.h>
#define ll long long

using namespace std;

const ll MAX = 100000000;

ll xTip[MAX];
ll oTip[MAX];

void precalc(ll n, ll m) {
    ll mx;
    if(n >= m) mx = n;
    else mx = m;

    for(int i=1; i<=mx; i++) {
        xTip[i] = i-(i/2);
        oTip[i] = i/2; 
    }
}

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

    ll n, m, res=0;
    cin >> n >> m;

    res += 2*n + 2*(m-2);

    precalc(n, m);
    ll brX = (n-2)/2;
    res += ((n-2-brX) * oTip[m-2] + brX * xTip[m-2]);

    cout << res << endl;
    return 0;
}