A, B = list(map(int, input().split()))

space = A - B * 2

if space < 0:

    space = 0

print(space)
a, b = list(map(int, input().split()))

ans = max(a - 2 * b, 0)

print(ans)
A, B = list(map(int, input().split()))
space = A - B * 2
if space < 0:
    space = 0
print(space)

a, b = list(map(int, input().split()))
ans = max(a - 2 * b, 0)
print(ans)

-A, B = list(map(int, input().split())) -space = A - B * 2 -if space < 0: -    space = 0 -print(space) +a, b = list(map(int, input().split())) +ans = max(a - 2 * b, 0) +print(ans)