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

if 0 <= x < y or x < y <= 0:

    print((y - x))

elif 0 < y < x or y < x < 0:

    print((x - y + 2))

else:

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

if x == -y:

    print((1))

elif abs(x) < abs(y):

    print((abs(y) - abs(x) + (x < 0) + (y < 0)))

else:

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

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

-if 0 <= x < y or x < y <= 0: -    print((y - x)) -elif 0 < y < x or y < x < 0: -    print((x - y + 2)) +if x == -y: +    print((1)) +elif abs(x) < abs(y): +    print((abs(y) - abs(x) + (x < 0) + (y < 0))) -    print((abs(abs(x) - abs(y)) + 1)) +    print((abs(x) - abs(y) + (x > 0) + (y > 0)))