A, B, O, W = map(int, input().split()) print(O + max(A + B) + W)