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