program ABC090C
    implicit none
    integer::n,m,ans=0,c
    read*,n,m
    if (n > m) then
        c = m
        m = n
        n = c
    end if
    if (n == 1 .AND. m == 1)then
        ans = 1
    else if (n == 1) then
        ans = m - 2
    else
        ans = (n-2)*(m-2)
    end if 
    print*,ans
end program ABC090C