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

if n == 1 or m == 1:

    print((max(n, m) - 2 if n * m > 1 else 1))

else:

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

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

if n == 1 or m == 1:

    print((1 if n * m == 1 else max(n, m) - 2))

else:

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

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

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

-    print((max(n, m) - 2 if n * m > 1 else 1)) +    print((1 if n * m == 1 else max(n, m) - 2))