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

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