input = list(map(int, input().split()))
n = input[0]
m = input[1]
if n == m == 1:
    print(1)
elif n == 1 and m == 2 or n == 2 and m == 1:
    print(4)
elif n == 1 and m % 2 != 0 or m == 1 and n % 2 != 0:
    print(6)
elif n % 2 == 0 and m % 2 == 0:
    print(6)
elif n == 2 and m == 3 or m == 3 and n == 2:
    print(8)
elif n % 2 == 0 and m % 2 != 0 or n % 2 != 0 and m % 2 == 0:
    print(12)
else:
    print(16)
