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

r = a-b*2

if r <= 0:

    print((0))

else:

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

ans=A-B*2

print((ans if ans>=0 else 0))
a, b = list(map(int, input().split()))
r = a - b * 2
if r <= 0:
    print((0))
else:
    print(r)

A, B = list(map(int, input().split()))
ans = A - B * 2
print((ans if ans >= 0 else 0))

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