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(((m-2)*(n-2)))
n, m = list(map(int, input().split()))

if n == 1 and m == 1:

	print((1))

	exit()

if n == 1 or m == 1:

	print((max(max(n,m)-2,0)))

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 n == 1:
    print((m - 2))
elif m == 1:
    print((n - 2))
else:
    print(((m - 2) * (n - 2)))

n, m = list(map(int, input().split()))
if n == 1 and m == 1:
    print((1))
    exit()
if n == 1 or m == 1:
    print((max(max(n, m) - 2, 0)))
elif n == 2 or m == 2:
    print((0))
else:
    print(((n - 2) * (m - 2)))

-elif n == 1: -    print((m - 2)) -elif m == 1: -    print((n - 2)) +    exit() +if n == 1 or m == 1: +    print((max(max(n, m) - 2, 0))) +elif n == 2 or m == 2: +    print((0)) -    print(((m - 2) * (n - 2))) +    print(((n - 2) * (m - 2)))