#include <bits/stdc++.h>
#define ff(i, a, b) for(int(i)=a; (i)<b; (i)++)
#define fb(i, a, b) for(int(i)=a; (i)>b; (i)--)
#define vt vector
#define pb push_back
#define ll long long
#define ull unsigned long long
#define bn "\n"
#define sp " "

using namespace std;

void solve(){
    int n, m; cin >> n >> m;
    ll ans = 0;
    ans += (2*m) + (2*(n-2));
    if(ans == n*m){cout << ans << bn; return;}

    //bojenje sahovski, da mi broj crnih polja bude sto manji
    if(m%2==0){
        ans = ans + (m/2)*(n-2);
        cout << ans << bn;
        return;
    }
    else{
        if(n%2==0){
            ans = ans + (m-2)*((n-2)/2);
            cout << ans << bn; return;
        }
        else{
            ans = ans + (m-2)*((n-3)/2) + (m-2)/2;
            cout << ans << bn; return;
        }
    }
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cerr.tie(0);
    solve();
    return 0;
}