local n, m = io.read("*n", "*n")
if n == 1 then
  if m == 1 then
    print(1)
  else
    print(m - 2)
  end
elseif n == 2 then
  print(0)
else
  if m == 1 then
    print(n - 2)
  elseif m == 2 then
    print(0)
  else
    print((n - 2) * (m - 2))
  end
end
