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: interview

Starter code:

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))

'''
[C - Flip,Flip, and Flip......](https://atcoder.jp/contests/arc091/tasks/arc091_a)
'''

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

else :
    if 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 and M == 1:
    print(1)
elif N == 1:
    print(M-2)
elif M == 1:
    print(N-2)
else:
    print(N*M-(N+M-2)*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)

# author:  Taichicchi
# created: 28.09.2020 23:24:54

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)))


# 30
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 = map(int, input().split())
print(abs(n-2)*abs(m-2))

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

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

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))

#!/usr/bin/env python3
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: # M > 1
        print((M - 2)) # 両端
        return

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

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

def __starting_point():
    main()

__starting_point()

# coding: utf-8


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()


N,M = map(int,input().split())

if N == 1:
    if M > 2:
        print(M-2)
    else:
        if M == 1:
            print(1)
        else:
            print(0)
elif N == 2 or M == 2:
    print(0)
else:
    if M > 2:
        print((N-2)*(M-2))
    else:
        if M == 1:
            print((N-2))

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)))


n,m=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))

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


row, col = map(int, input().split(' '))
#up boundary 0
#down boundary n - 1
#left boundary 0
#right boundary m - 1
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 == 1:
    if M == 1:
        print(1)
    else:
        print((N-2)*(M-2)*(-1))
else:
    if M == 1:
        print((N-2)*(M-2)*(-1))
    else:
        print((N-2)*(M-2))

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)
elif n == 2 or m == 2:
    print(0)
else:
    print(m * n - (2 * n + 2 * m - 4))

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

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))

N, M = map(int,input().split())

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

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

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

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

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

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

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)


#template
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

#import
# from copy import deepcopy
# from decimal import Decimal
# from math import ceil,floor
# from collections import deque,Counter
# from heapq import heapify,heappop,heappush
# from itertools import accumulate,product,permutations,combinations,combinations_with_replacement
# from bisect import bisect_left,bisect_right

#solution
def sol():
    return None

def main():
    #input data
    n,m = read_ints()
    #solve
    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()

#https://qiita.com/goto_yuta_/items/1c104e332351ab9389a6
# 入力を整数に変換して受け取る
import sys
sys.setrecursionlimit(10 ** 6)#pypy3はnumpyを使えない，この行を消すこと．
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力の文字列を1文字ずつに分けたものの配列を受け取る
def LC(): return list(input())
# 入力の数字列を1桁ずつに分けたものの配列を受け取る
def IC():return [int(c) for c in input()]
#少ない1行のint変数に入れる様の入力．例:N, A, B = map(int, input().split())
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 and m>=2:
    print(((n-2)*(m-2)))
    return
if n==1 and m>=2:
    print((m-2))
elif n>=2 and m==1:
    print((n-2))
else:
    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==2 or M==2) or N*M == 2:
    print(0)
else:
    N = N-2 if N>2 else 1
    M = M-2 if M>2 else 1
    print(N*M)

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)

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))
elif N==2 or M==2:print((0))
else:print(((M-2)*(N-2)))


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-2)*(M-2))

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	sample
# CreatedDate:  2020-12-28 15:44:13 +0900
# LastModified: 2020-12-28 20:02:31 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


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=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:
    ans=(n-2)*(m-2)
    print(ans)


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

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


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 # only need for big input
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
    # print(f'n {n} m {m}')
    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 == 1 and m == 1:
    print(1)
elif n == 1 or m == 1:
    print(max(n, m)-2)
elif n >= 3 and m >= 3:
    print((n-2)*(m-2))
else:
    print(0)

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

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)

N, M = map(int, input().split())

if N == 1:
    if M == 1:
        print(1)
    else:
        print(M - 2)
    return
elif M == 1:
    print(N - 2)
    return
elif N == 2 or M == 2:
    print(0)
    return
else:
    print((N - 2) * (M - 2))

N, M = map(int, input().split())

if N == 1:
    if M == 1:
        ans = 1
    else:
        ans = M-2
elif M == 1:
    ans = N-2
else:
    ans = M*N - (2*N + 2*M - 4)

print(ans)

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)

N,M = list(map(int,input().split()))

if N ==1 and 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 >= 2 and M >= 2):
    print(((N - 2) * (M - 2)))

else:
    if (N == 1 and M >= 2):
        print((M-2))
    elif (N >= 2 and M == 1):
        print((N-2))
    else:  #N==M==1
        print("1")


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
else:
  if 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:
    print((1))
elif n==1 or m==1:
    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())
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*m-2*n-2*m+4
print(ans)

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()))
total = n*m

if n==1 and m==1:
  print((1))
  
elif n == 1 or m == 1:
  print((total - 2))

else:
  print((total - (2*(n+m-2))))
  


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))
else:
    if M==1:
        print(1)
    else:
        print(M-2)

# coding: utf-8
# Your code here!

N, M = map(int, input().split())



X = N * M
Y = abs((N-2) * (M-2))

print(Y)

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

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

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)

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(((M-2)*(N-2)))


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))

# coding: utf-8
# Your code here!
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, M = map(int, input().split())
if N == 1:
    if M == 1:
        print(1)
    else:
        print(M-2)
elif N == 2:
    print(0)
else:
    if M == 1:
        print(N-2)
    else:
        print((N-2)*(M-2))

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C_fix
# CreatedDate:  2020-10-01 22:03:15 +0900
# LastModified: 2020-10-01 22:18:35 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


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


def __starting_point():
    main()

__starting_point()

N,M = map(int,input().split())

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


print(ans)

n, k = map(int, input().split())
if n > 2 and k > 2:
    center = n * k - ( (k * 2) + (n-2)*2 )
    print(center)
else:
    if 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)

n,m = list(map(int,input().split()))
if n >= 2 and m >= 2 :
    print(((n-2)*(m-2)))
elif 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))


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


import sys
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-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))

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


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

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

#!/usr/bin/env python3
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


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    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 fractions import gcd
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):
    # lsはソート済みであること
    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')
    else:
        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')

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) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())



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)))