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