print((max(0,eval('-'+input().replace(' ','+')))))
print((max(0,eval('-'+input().replace(*' +')))))
print((max(0, eval("-" + input().replace(" ", "+")))))

print((max(0, eval("-" + input().replace(*" +")))))

-print((max(0, eval("-" + input().replace(" ", "+"))))) +print((max(0, eval("-" + input().replace(*" +")))))