a,b,o,w=map(int,input().split()) if o>0: print(max(a,b)+o+w) elif a>0 and a>=b: print(a+w) elif b>0 and b>=a: print(b+w) else: print(w)