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

if N == 1 and M == 1:

    print("1")

elif N == 1:

    print((M - 2))

elif M == 1:

    print((N - 2))

else:

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

if N == M == 1:

    print("1")

elif N == 1:

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

elif M == 1:

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

else:

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

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

-if N == 1 and M == 1: +if N == M == 1: -    print((M - 2)) +    print((max(0, M - 2))) -    print((N - 2)) +    print((max(0, N - 2))) -    print(((N - 2) * (M - 2))) +    print((max(N * M - (N - 1) * 2 - (M - 1) * 2, 0)))