#include<iostream>
using namespace std;
     
int main(){
    unsigned long long n,m;
    cin >> n >> m;
    unsigned long long br;
    if (n==1) {br=m;}
    else{
        if (m==1) {br=n;}
        else {br=2*n+2*(m-2)+((n-2)*(m-2))/2;}
    }
    cout << br;
    return 0;  
}