m = sum(map(int, input().split()))
p = int(input())
print(m if m < p * 2 else m - p * 2)

560179a80300528fd44e45a78d8b266f13040265
<mask token>

<mask token>
print(m if m < p * 2 else m - p * 2)

m = sum(map(int, input().split()))
p = int(input())
print(m if m < p * 2 else m - p * 2)
