#include <bits/stdc++.h>
using namespace std;
long long int n, m;

int main(){
    cin>>n>>m;
    if(n<=2 or m<=2)
        cout<<n*m<<endl;
    else 
        cout<<(((2*n)+(2*m))+((n-2)*(m-2))/2)-4<<endl;
    return 0;
}