from sys import stdin
inp = stdin.readline

n,m = [int(x) for x in inp().strip().split()]

if n==2 and m == 3 and n==3 and m == 2:
    print(8)
elif n==1 and m == 2 or n==2 and m==1:
    print(4)
else:
    print(2)