#include <bits/stdc++.h>
using namespace std;
long long n,m,rez;
int main(){
    scanf("%lld%lld", &n, &m);

    if((n==1) or (m==1)){
        rez=n*m;
        cout<<rez<<endl;
    }
    else{
        rez = (2*n) + ((m-2)*2) + (((m-2)*(n-2))/2);
        cout<<rez<<endl;
    }


return 0;}