n, m = list(map(int, input().split()))



if n >= 2 and m >= 2:

    print(((n-2)*(m-2)))

elif (n == 1 and m >= 3) or (n >= 3 and m == 1):

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

elif (n == 1 and m == 2) or (n == 2 and m == 1):

    print((0))

elif (n == 1 and m == 1):

    print((1))
n, m = list(map(int, input().split()))



if n*m == 1:

    print((1))

elif n == 1 or m == 1:

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

else:

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

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

-if n >= 2 and m >= 2: +if n * m == 1: +    print((1)) +elif n == 1 or m == 1: +    print((max(n, m) - 2)) +else: -elif (n == 1 and m >= 3) or (n >= 3 and m == 1): -    print((max(n, m) - 2)) -elif (n == 1 and m == 2) or (n == 2 and m == 1): -    print((0)) -elif n == 1 and m == 1: -    print((1))