x, y = list(map(int, input().split()))

if x*y == 0:

    if x <= y:

        print((abs(y-x)))

    else:

        print((abs(y-x)+1))

elif x*y < 0:

    print((abs(x+y)+1))

else:

    if x < y:

        print((y-x))

    else:

        print((x-y+2))
x, y = list(map(int, input().split()))

xs = [x, -x]

ys = [y, -y]

ans = float("inf")

for i, x in enumerate(xs):

    for j, y in enumerate(ys):

        if x + abs(x-y) == y:

            kouho = abs(x-y) + i + j

            ans = min(ans, kouho)

print(ans)
x, y = list(map(int, input().split()))
if x * y == 0:
    if x <= y:
        print((abs(y - x)))
    else:
        print((abs(y - x) + 1))
elif x * y < 0:
    print((abs(x + y) + 1))
else:
    if x < y:
        print((y - x))
    else:
        print((x - y + 2))

x, y = list(map(int, input().split()))
xs = [x, -x]
ys = [y, -y]
ans = float("inf")
for i, x in enumerate(xs):
    for j, y in enumerate(ys):
        if x + abs(x - y) == y:
            kouho = abs(x - y) + i + j
            ans = min(ans, kouho)
print(ans)

-if x * y == 0: -    if x <= y: -        print((abs(y - x))) -    else: -        print((abs(y - x) + 1)) -elif x * y < 0: -    print((abs(x + y) + 1)) -else: -    if x < y: -        print((y - x)) -    else: -        print((x - y + 2)) +xs = [x, -x] +ys = [y, -y] +ans = float("inf") +for i, x in enumerate(xs): +    for j, y in enumerate(ys): +        if x + abs(x - y) == y: +            kouho = abs(x - y) + i + j +            ans = min(ans, kouho) +print(ans)