def calc(H, W, ans):

    w0 = W // 2

    w1 = W - w0

    for h0 in range(1, H):

        Sa = h0 * W

        h1 = H - h0

        h2 = h1 // 2

        h3 = h1 - h2

        Sb1, Sc1 = h1 * w0, h1 * w1

        Sb2, Sc2 = h2 * W, h3 * W

        m1, _, M1 = sorted([Sa, Sb1, Sc1])

        m2, _, M2 = sorted([Sa, Sb2, Sc2])

        ans = min(ans, M1 - m1, M2 - m2)

    return ans



H, W = list(map(int, input().split()))

print((calc(W, H, calc(H, W, H * W))))
h, w = list(map(int, input().split()))

if h % 3 == 0 or w % 3 == 0:

    print((0))

else:

    a = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2)

    b = (h - h // 3) * (w - w // 2) - h // 3 * w

    c = min(h, w)

    h, w = w, h

    d = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2)

    e = (h - h // 3) * (w - w // 2) - h // 3 * w

    print((min(a, b, c, d, e)))
def calc(H, W, ans):
    w0 = W // 2
    w1 = W - w0
    for h0 in range(1, H):
        Sa = h0 * W
        h1 = H - h0
        h2 = h1 // 2
        h3 = h1 - h2
        Sb1, Sc1 = h1 * w0, h1 * w1
        Sb2, Sc2 = h2 * W, h3 * W
        m1, _, M1 = sorted([Sa, Sb1, Sc1])
        m2, _, M2 = sorted([Sa, Sb2, Sc2])
        ans = min(ans, M1 - m1, M2 - m2)
    return ans


H, W = list(map(int, input().split()))
print((calc(W, H, calc(H, W, H * W))))

h, w = list(map(int, input().split()))
if h % 3 == 0 or w % 3 == 0:
    print((0))
else:
    a = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2)
    b = (h - h // 3) * (w - w // 2) - h // 3 * w
    c = min(h, w)
    h, w = w, h
    d = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2)
    e = (h - h // 3) * (w - w // 2) - h // 3 * w
    print((min(a, b, c, d, e)))

-def calc(H, W, ans): -    w0 = W // 2 -    w1 = W - w0 -    for h0 in range(1, H): -        Sa = h0 * W -        h1 = H - h0 -        h2 = h1 // 2 -        h3 = h1 - h2 -        Sb1, Sc1 = h1 * w0, h1 * w1 -        Sb2, Sc2 = h2 * W, h3 * W -        m1, _, M1 = sorted([Sa, Sb1, Sc1]) -        m2, _, M2 = sorted([Sa, Sb2, Sc2]) -        ans = min(ans, M1 - m1, M2 - m2) -    return ans - - -H, W = list(map(int, input().split())) -print((calc(W, H, calc(H, W, H * W)))) +h, w = list(map(int, input().split())) +if h % 3 == 0 or w % 3 == 0: +    print((0)) +else: +    a = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2) +    b = (h - h // 3) * (w - w // 2) - h // 3 * w +    c = min(h, w) +    h, w = w, h +    d = (h // 3 + 1) * w - (h - 1 - h // 3) * (w // 2) +    e = (h - h // 3) * (w - w // 2) - h // 3 * w +    print((min(a, b, c, d, e)))