You are given a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, and initially, every card faces up. For each square containing a card, you will flip the card and its neighboring eight cards. The order of operations does not affect the final result. Find the number of cards that face down after all the operations. Constraints: 1 ≤ N, M ≤ 10^9. Input is given as N and M, and you need to output the number of cards that face down after all the operations. Example inputs and outputs are provided.

# Buggy version:
N,M = map(int,input().split())

n = min(N,M)
m = max(N,M)

if n == 1 & m == 1:
  print(1)
  exit()
if n == 1:
  print(m-2)
  exit()
print((n-2)*(m-2))

# Fixed version:
N,M = map(int,input().split())

n = min(N,M)
m = max(N,M)

if n == 1 and m == 1:
  print(1)
  exit()
if n == 1:
  print(m-2)
  exit()
print((n-2)*(m-2))

# Buggy version:
# -*- coding: utf-8 -*-
# 標準入力の取得
N, M = list(map(int, input().split()))

# 求解処理
result = max((N - 2) * (M - 2), 0)

# 結果出力
print(result)


# Fixed version:
# -*- coding: utf-8 -*-
# 標準入力の取得
N, M = list(map(int, input().split()))
N, M = min(N, M), max(N, M)

# 求解処理
N, M = min(N, M), max(N, M)
result = 0
if N == 1:
    if M == 1:
        result = 1
    else:
        result = M - 2
else:
    result = (N - 2) * (M - 2)

# 結果出力
print(result)

# Buggy version:
N,M = 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))

# Fixed version:
n,m = 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))

# Buggy version:
n, m = map(int, input().split())

if n == 1 and m == 1: ans = 1
elif n == 1 and m != 1: ans = n-2
elif n != 1 and m == 1: ans = m-2
else: ans = (n-2) * (m-2)
print(ans)

# Fixed version:
n, m = map(int, input().split())
if n != 1 and m != 1:
    ans = (n-2) * (m-2)
elif n == m == 1:
    ans = 1
elif n == 1 and m != 1:
    ans = m-2
else:
    ans = n-2
print(ans)

# Buggy version:
N,M = map(int, input().split())
if n == 1:
    if m == 1:
      print(1)
    else:
      print(m - 2)
elif m == 1:
  print(n - 2)
else: 
  print((N-2)*(M-2))


# Fixed version:
N, M = map(int, input().split())

if(N == 1):
    n = 1
else:
    n = N-2
if(M == 1):
    m = 1
else:
    m = M-2
print(n*m)

# Buggy version:
n,m=map(int,input().split())
if n==1 and m==1:
    print(1)
elif n==1 or M==1:
    print(n*m-2)
else:
    print((m-2)*(n-2))


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

# Buggy version:
N, M = map(int, input().split())
if N == 1 and M == 1:
  print(1)
elif N == 1 or M == 1:
  print(max(N, M) - 1)
else:
  print((N - 2) * (M - 2))

# Fixed version:
N, M = map(int, input().split())

if N == 1 and M == 1:
    print(1)
    exit()

if N == 1 or M == 1:
    print(max(N - 2, M - 2))
else:
    print((N - 2) * (M - 2))

# Buggy version:
N,M=list(map(int, input().split()))
if N>1 and M>1:
  print(N*M - (N-2)*(M-2))
else:
  print(N*M-2)

# Fixed version:
N, M = sorted(list(map(int, input().split())))
if N == 1 and M == 1:
	print(1)
elif N == 1 and M > 1:
	print(M-2)
else:
	print((N-2)*(M-2))

# Buggy version:
H, W = map(int, input().split())
print((H - 2) * (W - 2))

"""
stage = [[0 for _ in range(W)] for _ in range(H)]
ds = ((0, 0), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1))

def setv(p, v):
	global stage
	stage[p[1]][p[0]] = v

def getv(p):
	return stage[p[1]][p[0]]

def move(p, d):
	r = (p[0] + d[0], p[1] + d[1])
	if not (0 <= r[0] < W) or not (0 <= r[1] < H):
		return None
	return r

for h in range(H):
	for w in range(W):
		for d in ds:
			nextp = move((w, h), d)
			if not nextp:
				continue
			setv(nextp, (getv(nextp) + 1) % 2)
			#setv(nextp, (getv(nextp) + 1))

for h in range(H):
	print(*stage[h], sep="")
print()
"""

# Fixed version:
H, W = map(int, input().split())

"""
stage = [[0 for _ in range(W)] for _ in range(H)]
ds = ((0, 0), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1))

def setv(p, v):
	global stage
	stage[p[1]][p[0]] = v

def getv(p):
	return stage[p[1]][p[0]]

def move(p, d):
	r = (p[0] + d[0], p[1] + d[1])
	if not (0 <= r[0] < W) or not (0 <= r[1] < H):
		return None
	return r

for h in range(H):
	for w in range(W):
		for d in ds:
			nextp = move((w, h), d)
			if not nextp:
				continue
			setv(nextp, (getv(nextp) + 1) % 2)
			#setv(nextp, (getv(nextp) + 1))

for h in range(H):
	print(*stage[h], sep="")
print()
"""

if 1 == H == W:
	print(1)
	exit()

if 1 == H and not 1 == W:
	print(W - 2)
	exit()

if 1 == W and not 1 == H:
	print(H - 2)
	exit()

print((H - 2) * (W - 2))

# Buggy version:
a,b=map(int,input().split())
if a==1 and b==1:
  print(1)
elif a==1 or b==1:
  print(max(a,b)-2)
else:
  print(a+a+b+b-8+(a-2)*(b-2))

# Fixed version:
a,b=map(int,input().split())
if a==1 and b==1:
  print(1)
elif a==1 or b==1:
  print(max(a,b)-2)
else:
  print((a-2)*(b-2))

# Buggy version:
a,b=map(int,input().split())
if a==1 and b==1:
  print(1)
elif a==1 or b==1:
  print(max(a,b)-2)
else:
  print(a+a+b+b-4)

# Fixed version:
a,b=map(int,input().split())
if a==1 and b==1:
    print(1)
elif a==1 or b==1:
    print(max(a,b)-2)
elif a==2 or b==2:
    print(0)
else:
    print(a*b-2*a-2*b+4)

# Buggy version:
n,m=map(int,input().split())
if n==2 or m==2:
    print(0)
elif n==m==1:
    print(1)
elif n==1 or m==1:
    print(max(n,m)-2)
else:
    print((n-2)(m-2))

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

# Buggy version:
N,N = list(map(int,input().split()))
if N == 1 and M == 1:
    print(1)
elif N == 1 or M == 1:
    print(max([N,M]) -2)
else:
    print( N * M + 4 - 2*(N+M))


# Fixed version:
N,M = list(map(int,input().split()))
if N == 1 and M == 1:
    print(1)
elif N == 1 or M == 1:
    print(max([N,M]) -2)
else:
    print( N * M + 4 - 2*(N+M))

# Buggy version:
b = list(map(int,input().split()))

if b[0] == 1 and b[1] == 1:
	print(1)
elif b[0] == 1:
	print(b[1]-2)
elif b[1] == 1:
	print(b[0] -2)

else:
	print(b[0]*b[1] - 2(b[0] + b[1] - 2))

# Fixed version:
b = list(map(int,input().split()))

if b[0] == 1 and b[1] == 1:
	print(1)
elif b[0] == 1:
	print(b[1]-2)
elif b[1] == 1:
	print(b[0] -2)

else:
	print(b[0]*b[1] - 2*(b[0] + b[1] - 2))

# Buggy version:
N, M = map(int, input().split(" "))

if M > N:
    tmp = N
    M = N
    N = tmp

if N == 1 and M == 1: print(1)
elif M == 1: print(N-2)
else: print((N-2)*(M-2))

# Fixed version:
N, M = map(int, input().split(" "))

if M > N:
    tmp = M
    M = N
    N = tmp

if N == 1 and M == 1: print(1)
elif M == 1: print(N-2)
else: print((N-2)*(M-2))

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

# Fixed version:
n, m = map(int,input().split())

if n==1 or m==1:
    if n==1 and m==1:
        print(1)
    else:
        if n == 1:
            print(m-2)
        else:
            print(n-2)
else:
    if n == 2 or m == 2:
        print(0)
    else:
        print((n-2)*(m-2))

# Buggy version:
N,M = map(int, input().split())
    if M==1 and N==1:
        return 1
    elif M==1:
        return N-2
    elif N==1:
        return M-2
    else:
        return (N-2)*(M-2)

# Fixed version:
N,M = map(int, input().split())
if M==1 and N==1:
    print(1)
elif M==1:
    print(N-2)
elif N==1:
    print(M-2)
else:
    print((N-2)*(M-2))

# Buggy version:
def solve():
    N, M = map(int, input().split())

    if N == 1:
        print(N-2)
        return

    if M == 1:
        print(M-2)
        return

    print((N-2) * (M-2))


if __name__ == "__main__":
    solve()



# Fixed version:
def solve():
    N, M = map(int, input().split())

    if N == 1 and M == 1:
        print(1)
        return

    if N == 1:
        print(M-2)
        return

    if M == 1:
        print(N-2)
        return

    print((N-2) * (M-2))


if __name__ == "__main__":
    solve()

# Buggy version:
N,M=map(int,input().split())
if N==1:
  if M==1:
    print(1)
  else:
    print(M-2)
elif M==1:
  print(N-2)
else:
  print(N*M-max(0,N-2)-max(0,M-2))

# Fixed version:
N,M = map(int,input().split())
if N == M and N == 1:
    print(1)
elif min(N,M) == 1:
    print(max(N,M)-2)
elif min(N,M) == 2:
    print(0)
else:
    print((N-2)*(M-2))

# Buggy version:
n,m=map(int,input().split())
if n>m:
    n,m=m,n
if n==1 and m==1:
    print(1)
elif n==1:
    print(2)
else:
    print((n-2)*(m-2))

# Fixed version:
n,m = map(int,input().split())
if n>m: n,m = m,n
if n== 1:
    if m==1:
        print(1)
    else:
        print(m-2)
elif n== 2:
    print(0)
else:
    print((n-2)*(m-2))

# Buggy version:
N,M = map(int, input().split())
    if M==1 and N==1:
        print(1)
    elif M==1:
        print(N-2)
    elif N==1:
        print(M-2)
    else:
        print((N-2)*(M-2))


# Fixed version:
N, M = map(int, input().split())
if N == M == 1:
  print(1)
elif N == 1:
  print(M-2)
elif M == 1:
  print(N-2)
else:
  print((N-2)*(M-2))