Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below. Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.  
H, W = map(int, input().split())
if H % 3 == 0 or W % 3 == 0:    
    print(0)
    exit()

answer = float('inf')

h = 1
for _ in range(H):
    a = h * W
    b = (H-h) * (W // 2)
    c = H * W - a - b
    MAX = max([a, b, c])
    MIN = min([a, b, c])
    if MAX - MIN <= answer:
        answer = MAX - MIN
    h += 1

w = 1
for _ in range(W):
    a = w * H
    b = (W-w) * (H // 2)
    c = H * W - a - b
    MAX = max([a, b, c])
    MIN = min([a, b, c])
    if MAX - MIN <= answer:
        answer = MAX - MIN
    w += 1

print(answer)
x, y = map(int, input().split())
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
group3 = [2]
if x in group1 and y in group1:
    print('Yes')
elif x in group2 and y in group2:
    print('Yes')
elif x in group3 and y in group3:
    print('Yes')
else:
    print('No')
