program main
implicit None
	integer::n,m
	read *,n,m
	
	if(n == 1 .or. m == 1)then
		if(n*m = 1)then
			print 101,1
			stop
		endif
		print 101,n*m-2
		stop
	endif
	
	print 101,(n-2)*(m-2)
101 format(i0)
end program main