A, B, O, W = map(int, input().split()) print(max([(O >= 1) * (max(A, B) + O + W), (A >= 1) * (A + W), (B >= 1) * (B + W), W]))