#include <bits/stdc++.h>

using namespace std;

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