N=io.read("n")
M=io.read("n")
local count=0
if N==1 and M==1 then
  count=1
  elseif N==1 and M>=3 then
  count=M-2
  elseif M==1 and N>=3 then
  count=N-2
  elseif N==2 or M==2 then
  count=0
  elseif N>=3 and M>=3 then
  count=(N-2)*(M-2)
end
print(count)

