import math

import sys

import collections

import bisect

readline = sys.stdin.readline





def main():

    n, m = list(map(int, readline().rstrip().split()))

    if n == 1 or m == 1:

        print((abs(abs(n - m) - 1)))

        return

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





if __name__ == '__main__':

    main()

import math

import sys

import collections

import bisect

readline = sys.stdin.readline





def main():

    n, m = list(map(int, readline().rstrip().split()))

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





if __name__ == '__main__':

    main()

import math
import sys
import collections
import bisect

readline = sys.stdin.readline


def main():
    n, m = list(map(int, readline().rstrip().split()))
    if n == 1 or m == 1:
        print((abs(abs(n - m) - 1)))
        return
    print((abs((m - 2) * (n - 2))))


if __name__ == "__main__":
    main()

import math
import sys
import collections
import bisect

readline = sys.stdin.readline


def main():
    n, m = list(map(int, readline().rstrip().split()))
    print((abs((m - 2) * (n - 2))))


if __name__ == "__main__":
    main()

-    if n == 1 or m == 1: -        print((abs(abs(n - m) - 1))) -        return