#include "bits/stdc++.h"
#define ll long long
#define pb push_back
using namespace std;



void solve() {
    ll a,b;
    cin>>a>>b;
    if(a==1||b==1){
        cout<<a*b<<endl;
    }
    else{
        cout<<2*(a+b)-4+((a-2)*(b-2)/2)<<endl;
    }
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t=1;
    /*
    cin>>t;
    //*/
    while(t--) {
        solve();
    }
}