#include <stdio.h>
#include <stdlib.h>

int main()
{
    unsigned m,n, s=0;
    scanf("%ld %ld", &m, &n);
    unsigned obim = 2*m +2*(n-2);
    if(m==1 && n==1){
        s=1;
    }
    else if(m==1 || n==1){
        s=(m+n)-1;
        s=s/2;
    }
    else{
        s+=(m-2)*(n-2)/2;
        s+=obim;
    }
    printf("%ld", s);
    return 0;
}