import std.stdio,
       std.string,
       std.conv,
       std.algorithm;

void main() {
  long [] a = readln.chomp.split.to!(long[]);
  long N = a[0], M = a[1];
  long ans;

  if (N == 1 && M == 1) {
    ans = 1;
  }
  else if (N == 1 || M == 1) {
    ans = max(N, M) - 2;
  }
  else if (N == 2 || M == 2) {
    ans = 0;
  }
  else {
    ans = (N - 2) * (M - 2);
  }

  writeln(ans);
}
