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

if N==1 and M==1:

    ans = 1

elif N==1 or M==1:

    ans = max(N-2,M-2)

elif N==2 or M==2:

    ans = 0

else:

    ans = N*M-2*(N+M-2)

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

if N==1 and M==1:

    print((1))

elif N==1 and M>1:

    print((M-2))

elif N>1 and M==1:

    print((N-2))

else:

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

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

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