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

if n == 1 and m == 1:

    print((1))

elif n == 1 or m == 1:

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

elif n == 2 or m == 2:

    print((0))

else:

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

def solve(string):

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

    if n == 1 and m == 1:

        return "1"

    elif n == 1 or m == 1:

        return str(max(n - 2, m - 2))

    elif n == 2 or m == 2:

        return "0"

    else:

        return str((n - 2) * (m - 2))





if __name__ == '__main__':

    print((solve(eval(input()))))

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

def solve(string):
    n, m = list(map(int, string.split()))
    if n == 1 and m == 1:
        return "1"
    elif n == 1 or m == 1:
        return str(max(n - 2, m - 2))
    elif n == 2 or m == 2:
        return "0"
    else:
        return str((n - 2) * (m - 2))


if __name__ == "__main__":
    print((solve(eval(input()))))

-n, m = list(map(int, input().strip().split(" "))) -if n == 1 and m == 1: -    print((1)) -elif n == 1 or m == 1: -    print((max(n - 2, m - 2))) -elif n == 2 or m == 2: -    print((0)) -else: -    print(((n - 2) * (m - 2))) +def solve(string): +    n, m = list(map(int, string.split())) +    if n == 1 and m == 1: +        return "1" +    elif n == 1 or m == 1: +        return str(max(n - 2, m - 2)) +    elif n == 2 or m == 2: +        return "0" +    else: +        return str((n - 2) * (m - 2)) + + +if __name__ == "__main__": +    print((solve(eval(input()))))