a,b=[int(i) for i in input().split()] c,d=[int(i) for i in input().split()] if a<0: a*=-1 if b<0: b*=-1 if c<0: c*=-1 if d<0: d*=-1 print((a+b+c+d)//2)