#include <bits/stdc++.h>
using namespace std;
long long N, M, ukupno;
int main(){
    scanf("%lld",&N);
    scanf("%lld",&M);
    if(M==1 or M==2 or N==1 or N==2)
        cout<<M*N<<endl;
    else{
    ukupno =2*(N+M-2)+ round((N-2)*(M-2)/2);
        cout<<ukupno;
    }
    return 0;
}