There is 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.
We will perform the following operation once for each square contains a card:
 - For each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.
It can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed.
Find the number of cards that face down after all the operations.

-----Constraints-----
 - 1 \leq N,M \leq 10^9
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
N M

-----Output-----
Print the number of cards that face down after all the operations.

-----Sample Input-----
2 2

-----Sample Output-----
0

We will flip every card in any of the four operations. Thus, after all the operations, all cards face up.

Difficulty: MEDIUM_HARD

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


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


(n, m) = list(map(int, input().split()))
inner_num = (n - 2) * (m - 2)
ans = 0
if n == 1 and m == 1:
	ans = 1
elif n == 1:
	ans = m - 2
elif m == 1:
	ans = n - 2
else:
	outter_num = 0
	ans = inner_num
print(ans)


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


(N, M) = list(map(int, input().split()))
if N > M:
	(N, M) = (M, N)
res = 0
if N == 1 and M == 1:
	res = 1
elif N == 2:
	res = 0
else:
	res = max(1, N - 2) * max(1, M - 2)
print(res)


(N, M) = map(int, input().split())
print(abs((N - 2) * (M - 2)))


import sys
pin = sys.stdin.readline

def main():
	(N, M) = map(int, pin().split())
	print(abs((N - 2) * (M - 2)))
	return
main()


(N, M) = list(map(int, input().split()))
if N > 1 and M > 1:
	print((N - 2) * (M - 2))
else:
	print(abs(max([M, N]) - 2))


import sys
input = sys.stdin.readline
(n, m) = list(map(int, input().split()))
if n == m == 1:
	print(1)
elif min(n, m) == 1:
	print(max(n, m) - 2)
else:
	print((n - 2) * (m - 2))


(n, m) = map(int, input().rstrip().split(' '))
ans = 0
if n == 1 and m == 1:
	ans = 1
elif n == 1:
	ans = m - 2
elif m == 1:
	ans = n - 2
else:
	ans = (n - 2) * (m - 2)
print(ans)


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


(n, m) = list(map(int, input().split()))
if n == 1:
	if m >= 2:
		print(m - 2)
		return
	else:
		print(1)
		return
elif n == 2:
	print(0)
elif m == 1:
	print(n - 2)
	return
elif m == 2:
	print(0)
	return
else:
	print(m * n - 2 * m - 2 * n + 4)
	return


(n, m) = map(int, input().split())
print(abs((n - 2) * (m - 2)))


(n, m) = map(int, input().split())
if (n == 1) & (m == 1):
	ans = 1
elif (n == 1) | (m == 1):
	ans = n + m - 3
else:
	ans = (n - 2) * (m - 2)
print(ans)


(n, m) = map(int, input().split())
q = [n, m]
if n == 1 and m == 1:
	print(1)
	return
if 1 in q:
	print(n * m - 2)
	return
if 2 in q:
	print(0)
	return
print((n - 2) * (m - 2))


(n, m) = map(int, input().split())
ret = 0
if n == 1 and m == 1:
	ret = 1
elif n == 1 or m == 1:
	ret = n * m - 2
else:
	ret = m * n - m * 2 - n * 2 + 4
print(ret)


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


(n, m) = map(int, input().split())
ans = 0
if n == 1 or m == 1:
	if n == 1 and m == 1:
		ans = 1
	else:
		ans = abs(n - m) - 1
else:
	ans = n * m - (2 * n + 2 * m) + 4
print(ans)


(N, M) = [int(n) for n in input().split()]
if N == 1 and M == 1:
	print(1)
elif N == 2 and M == 1:
	print(0)
elif N == 1 and M == 2:
	print(0)
elif N == 2 and M == 2:
	print(0)
elif N == 1 and M > 2:
	print(M - 2)
elif N > 2 and M == 1:
	print(N - 2)
else:
	print((N - 2) * (M - 2))


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


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


import sys

def solve(N: int, M: int):
	(N, M) = (min(N, M), max(N, M))
	if N == 1 and M == 1:
		print(1)
		return
	if N == 1:
		print(M - 2)
		return
	ans = (N - 2) * (M - 2)
	print(ans)
	return

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	N = int(next(tokens))
	M = int(next(tokens))
	solve(N, M)

def __starting_point():
	main()
__starting_point()


def main():
	(N, M) = list(map(int, input().split()))
	if N == 1 or M == 1:
		ans = N * M - 2
		if ans < 0:
			ans = 1
	else:
		ans = N * M - (N + M) * 2 + 4
	print(ans)

def __starting_point():
	main()
__starting_point()


(N, M) = list(map(int, input().split()))
if N * M == 2:
	print(0)
	return
if N * M == 1:
	print(1)
	return
if N == 1:
	print(M - 2)
	return
if M == 1:
	print(N - 2)
	return
print((N - 2) * (M - 2))


import sys
import math
import itertools
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
input = sys.stdin.readline

def RD():
	return input().rstrip()

def F():
	return float(input().rstrip())

def I():
	return int(input().rstrip())

def MI():
	return map(int, input().split())

def MF():
	return map(float, input().split())

def LI():
	return list(map(int, input().split()))

def TI():
	return tuple(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def Init(H, W, num):
	return [[num for i in range(W)] for j in range(H)]

def main():
	(N, M) = MI()
	if N == 1 and M == 1:
		print(1)
		return
	elif N == 1:
		print(M - 2)
		return
	elif M == 1:
		print(N - 2)
		return
	print((M - 2) * (N - 2))

def __starting_point():
	main()
__starting_point()


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
(n, m) = list(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 * m - (n * 2 + m * 2 - 4))


(row, col) = map(int, input().split(' '))
res = 0
if row > 1 and col > 1:
	res = (row - 2) * (col - 2)
elif row == 1 and col == 1:
	res = 1
elif row == 1:
	res = col - 2
else:
	res = row - 2
print(res)


(N, M) = map(int, input().split())
if N >= 2:
	N -= 2
if M >= 2:
	M -= 2
print(N * M)


(a, b) = map(int, input().split())
print(abs(a * b - (2 * a + 2 * b - 4)))


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


import sys
sys.setrecursionlimit(10 ** 9)
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
read_int = lambda : int(readline())
read_ints = lambda : map(int, readline().split())
read_ints_list = lambda : list(map(int, readline().split()))
read_ints_grid = lambda h: list((list(map(int, readline().split())) for _ in range(h)))
read_strs_list = lambda : list(map(str, readline().rstrip().split()))
read_strs_grid = lambda h: list((list(map(str, readline().rstrip().split())) for _ in range(h)))

def read_allints_grid(w):
	grid = map(int, read().split())
	grid = list(map(list, zip(*(grid for _ in range(w)))))
	return grid

def read_allstrs_grid(w):
	grid = map(str, read().split())
	grid = list(map(list, zip(*(grid for _ in range(w)))))
	return grid

def sol():
	return None

def main():
	(n, m) = read_ints()
	if n == m == 1:
		print(1)
	elif n == 1 or m == 1:
		print(max(n, m) - 2)
	else:
		print((n - 2) * (m - 2))
	return None

def __starting_point():
	main()
__starting_point()


import sys
sys.setrecursionlimit(10 ** 6)

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LC():
	return list(input())

def IC():
	return [int(c) for c in input()]

def MI():
	return map(int, input().split())

def solve():
	(N, M) = MI()
	if N == M == 1:
		print(1)
	elif N == 1:
		print(M - 2)
	elif M == 1:
		print(N - 2)
	else:
		print(N * M - (2 * N + 2 * M - 4))
	return
solve()


(n, m) = 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 < 2 or M < 2:
	if N == M:
		print(1)
	else:
		print(max(N, M) - 2)
elif N == 2 or M == 2:
	print(0)
else:
	print((N - 2) * (M - 2))


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


import os
import sys

def main():
	(N, M) = list(map(int, input().split()))
	if N == 1 and M == 1:
		print(1)
	elif N == 1 and M != 1:
		print(M - 2)
	elif N != 1 and M == 1:
		print(N - 2)
	else:
		print((N - 2) * (M - 2))

def __starting_point():
	main()
__starting_point()


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


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


n = list(map(int, input().split()))
if n[0] == 1 or n[1] == 1:
	tmp = max(n)
	if tmp == 1:
		print('1')
	elif tmp == 2:
		print('0')
	else:
		print(tmp - 2)
elif (n[0] == 2 or n[1] == 2) and (n[0] != 1 and n[1] != 1):
	print('0')
else:
	print((n[0] - 2) * (n[1] - 2))


from sys import stdin, stdout
from itertools import permutations

def read_int_from_line():
	return list(map(int, input().split()))

def solve():
	(n, m) = read_int_from_line()
	if n > m:
		(n, m) = (m, n)
	if n == 1:
		if m == 1:
			print(1)
		else:
			print(m - 2)
	else:
		print((n - 2) * (m - 2))

def main():
	solve()

def __starting_point():
	main()
__starting_point()


(N, M) = map(int, input().split())
if N == 2 or M == 2:
	B = 0
elif N == 1 or M == 1:
	if N == M:
		B = 1
	elif N < M:
		B = M - 2
	else:
		B = N - 2
else:
	B = N * M - M * 2 - N * 2 + 4
print(B)


(a, b) = map(int, input().split())
if a >= 2 and b >= 2:
	print((a - 2) * (b - 2))
elif a == 1 and b == 1:
	print(1)
else:
	print(a * b - 2)


(A, B) = map(int, input().split())
if A > 1:
	if B > 1:
		a = (A - 2) * (B - 2)
	elif B == 1:
		a = A - 2
	else:
		a = 0
elif B > 1:
	a = B - 2
elif B == 1:
	a = 1
else:
	a = 0
print(a)


(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 - (n + m) * 2 + 4)


(N, M) = list(map(int, input().split()))
if N == 1 and M == 1:
	ans = 1
elif N == 1:
	ans = M - 2
elif M == 1:
	ans = N - 2
elif N == 2 or M == 2:
	ans = 0
else:
	ans = N * M - (2 * N + 2 * M - 4)
print(ans)


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


d = list(map(int, input().split()))
N = min(d)
M = max(d)
if N >= 2:
	print((N - 2) * (M - 2))
elif M == 1:
	print(1)
else:
	print(M - 2)


(N, M) = map(int, input().split())
X = N * M
Y = abs((N - 2) * (M - 2))
print(Y)


import sys
(N, M) = map(int, input().split())
if N == 1 and 3 <= M:
	print(M - 2)
	return
if M == 1 and 3 <= N:
	print(N - 2)
	return
print(M * N - (2 * N + 2 * M - 4))


(N, M) = map(int, input().split())
if N == 1 and M == 1:
	print(1)
elif min(N, M) == 1:
	print(N + M - 3)
elif min(N, M) == 2:
	print(0)
else:
	print((N - 2) * (M - 2))


(a, b) = map(int, input().split())
if min(a, b) >= 3:
	print((a - 2) * (b - 2))
	return
if a > b:
	(a, b) = (b, a)
if a == 1 and b >= 3:
	print(b - 2)
if a == 2 and b >= 3:
	print(0)
if [a, b] == [1, 1]:
	print(1)
if [a, b] == [1, 2]:
	print(0)
if [a, b] == [2, 2]:
	print(0)


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


import sys
readline = sys.stdin.readline
read = sys.stdin.read
(n, m) = list(map(int, readline().split()))
if n == 1 and m == 1:
	print(1)
elif n == 1 or m == 1:
	print(max(n, m) - 2)
else:
	print((n - 2) * (m - 2))


(n, k) = map(int, input().split())
if n > 2 and k > 2:
	center = n * k - (k * 2 + (n - 2) * 2)
	print(center)
elif n == 1 and k == 1:
	print(1)
elif n == 1 or k == 1:
	if n > k:
		print(n - 2)
	else:
		print(k - 2)
else:
	print(0)


import sys
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from math import *
sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
eps = 1e-20
MOD = 10 ** 9 + 7

def mint():
	return map(int, input().split())

def lint():
	return list(map(int, input().split()))

def ilint():
	return (int(input()), list(map(int, input().split())))

def judge(x, l=['Yes', 'No']):
	print(l[0] if x else l[1])

def lprint(l, sep='\n'):
	for x in l:
		print(x, end=sep)
(N, M) = mint()
if N == M == 1:
	print(1)
else:
	print(abs(N - 2) * abs(M - 2))


def lmi():
	return list(map(int, input().split()))

def main():
	(N, M) = lmi()
	if N == 1 or M == 1:
		print(abs(N - 2) * abs(M - 2))
	else:
		print((N - 2) * (M - 2))

def __starting_point():
	main()
__starting_point()


(N, M) = 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 - (2 * (N + M) - 4))


import sys

def solve(N: int, M: int):
	if N == 1 and M == 1:
		print(1)
	elif N == 1 or M == 1:
		print(max(N, M) - 2)
	else:
		print(N * M - 2 * N - 2 * M + 4)
	return

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	N = int(next(tokens))
	M = int(next(tokens))
	solve(N, M)

def __starting_point():
	main()
__starting_point()


from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
from copy import copy, deepcopy
from itertools import product, permutations, combinations, combinations_with_replacement
from bisect import bisect_left, bisect_right
from math import sqrt, gcd, ceil, floor, factorial
from functools import reduce
from pprint import pprint
from statistics import mean, median, mode
import sys
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
mod = 10 ** 9 + 7

def mycol(data, col):
	return [row[col] for row in data]

def mysort(data, col, reverse=False):
	data.sort(key=lambda x: x[col], reverse=revese)
	return data

def mymax(data):
	M = -1 * float('inf')
	for i in range(len(data)):
		m = max(data[i])
		M = max(M, m)
	return M

def mymin(data):
	m = float('inf')
	for i in range(len(data)):
		M = min(data[i])
		m = min(m, M)
	return m

def mycount(ls, x):
	l = bisect_left(ls, x)
	r = bisect_right(ls, x)
	return r - l

def mydictvaluesort(dictionary):
	return sorted(list(dictionary.items()), key=lambda x: x[1])

def mydictkeysort(dictionary):
	return sorted(list(dictionary.items()), key=lambda x: x[0])

def myoutput(ls, space=True):
	if space:
		if len(ls) == 0:
			print(' ')
		elif type(ls[0]) == str:
			print(' '.join(ls))
		elif type(ls[0]) == int:
			print(' '.join(map(str, ls)))
		else:
			print('Output Error')
	elif len(ls) == 0:
		print('')
	elif type(ls[0]) == str:
		print(''.join(ls))
	elif type(ls[0]) == int:
		print(''.join(map(str, ls)))
	else:
		print('Output Error')

def I():
	return int(input())

def MI():
	return list(map(int, input().split()))

def RI():
	return list(map(int, input().split()))

def CI(n):
	return [int(input()) for _ in range(n)]

def LI(n):
	return [list(map(int, input().split())) for _ in range(n)]

def S():
	return input()

def MS():
	return input().split()

def RS():
	return list(input())

def CS(n):
	return [input() for _ in range(n)]

def LS(n):
	return [list(input()) for _ in range(n)]
(n, m) = MI()
if n == 1 and m == 1:
	print(1)
elif n == 1 and m >= 2:
	print(m - 2)
elif n >= 2 and m == 1:
	print(n - 2)
else:
	print((n - 2) * (m - 2))