a,b,o,w = map(int, input().split()) print(max(w + a + o, w + b + o))