#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(){
    ull n, m; cin >> n >> m;
    ull ans = 0;
    if(n==1){ans = m; cout << ans << bn; return;}
    if(m==1){ans = n; cout << ans << bn; return;}

    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)/2)*(n-2);}
    else{
        if(n%2==0){ans = ans + (m-2)*((n-2)/2);}
        else{ans = ans + (m-2)*((n-3)/2) + (m-2)/2;}
    }

    cout << ans << bn;
}

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