#include <stdio.h>

int main()
{
    int n,m;
    int br=0;
    int sredina;
    scanf("%d%d",&n,&m);
    br+=2*m+2*n-4;
    br+=(m-2)*(n-2)/2;
    if (n==1){
        br=m;
    }
    if (m==1){
        br=n;
    }
    printf("%d",br);
    return 0;
}