#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,rez;
    cin >> n >> m;
    if(n==1){
        cout << m;
        return 0;
    }
    if(m==1){
        cout << n;
        return 0;
    }
    rez=2*n-2+2*m-2+((n-2)*(m-2))/2;
    cout << rez;
}