N,M = list(map(int,input().split()))



if N ==1 and M == 1:

  print((1))

elif min(N,M) == 1 and max(N,M) >= 3:

  print((N*M-2))

elif N == 2 or M == 2:

  print((0))

else:

  print(((N-2)*(M-2)))
N,M = list(map(int,input().split()))



if N == 1 and M == 1:

  print((1))

elif min(N, M) == 1:

  print((max(N, M) - 2))

else:

  print(((N-2)*(M-2)))
N, M = list(map(int, input().split()))
if N == 1 and M == 1:
    print((1))
elif min(N, M) == 1 and max(N, M) >= 3:
    print((N * M - 2))
elif N == 2 or M == 2:
    print((0))
else:
    print(((N - 2) * (M - 2)))

N, M = list(map(int, input().split()))
if N == 1 and M == 1:
    print((1))
elif min(N, M) == 1:
    print((max(N, M) - 2))
else:
    print(((N - 2) * (M - 2)))

-elif min(N, M) == 1 and max(N, M) >= 3: -    print((N * M - 2)) -elif N == 2 or M == 2: -    print((0)) +elif min(N, M) == 1: +    print((max(N, M) - 2))