#include<iostream>
using namespace std;
int redari(int a, int b){
    if(a==1&&b==1)return 1;
    if(a==1)return b;
    if(a==2||b==2)return a*b;
    int okolo = 2*a+2*(b-2);
    double c = (double)(a-2)/2;
    return okolo+(double)c*(b-2);
}
main()
{
    int a,b;
    cin>>a>>b;
    if(a<=b) cout<<redari(a,b);
    else cout<<redari(b,a);
}