program sample
    implicit none
  
    integer(8) :: i,j,m,n,h,k
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n,m
    if(n*m==1)then
        write(*,*)1
    elseif(n==1 .or. m==1)then
        write(*,*)n*m-2
        
    elseif(n==2 .or. m==2)then
        write(*,*) 0
    else
        write(*,*)(n-2)*(m-2)
    endif
  
    stop
end program sample
  

