'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ').map(n => Number(n));

  const N = s[0];
  const M = s[1];

  const ans = Math.abs(N - 2) * Math.abs(M - 2);

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
