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

c = a-b*2

if c <0:

    print((0))

else:

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

c = a-b*2



print(0) if c < 0 else print(c)

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

a, b = map(int, input().split())
c = a - b * 2
print(0) if c < 0 else print(c)

-a, b = list(map(int, input().split())) +a, b = map(int, input().split()) -if c < 0: -    print((0)) -else: -    print(c) +print(0) if c < 0 else print(c)