list1=[int(x) for x in input().split(' ')]
n=list1[0]
m=list1[1]
x=max(n,m)
y=min(n,m)
if x <= 1:
    print(2)
elif x == 2:
    if y == 2:
        print(6)
    else:
        print(4)
else:
    a=(x-1)*(x-2)+4
    if y == 1:
        print(a)
    else:
        b=a+(y-1)*(y-2)+2
        print(b)
